Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

343
Vistas
java.time.Instant.atZone(...) far in the past return crazy values

I detect the following output when converting an Instant that is far in the past to a ZonedDateTime.

Code as Unit-Test:

   @Test
public void testParseDate() {
    Instant instant = Instant.parse("0000-12-30T07:00:00Z");
    System.out.println(instant);
    System.out.println(instant.atZone(ZoneId.of("Europe/Berlin")));

    instant = Instant.parse("1800-12-30T07:00:00Z");
    System.out.println("---------------------------------");
    System.out.println(instant);
    System.out.println(instant.atZone(ZoneId.of("Europe/Berlin")));

    instant = Instant.parse("1900-12-30T07:00:00Z");
    System.out.println("---------------------------------");
    System.out.println(instant);
    System.out.println(instant.atZone(ZoneId.of("Europe/Berlin")));
}

Output:

0000-12-30T07:00:00Z
0000-12-30T07:53:28+00:53:28[Europe/Berlin]
---------------------------------
1800-12-30T07:00:00Z
1800-12-30T07:53:28+00:53:28[Europe/Berlin]
---------------------------------
1900-12-30T07:00:00Z
1900-12-30T08:00+01:00[Europe/Berlin]

In the first two outputs the time is 07:53:28+00:53:28 and the last output is 08:00+01:00[Europe/Berlin]. Maybe the root cause is that the time zone stuff doesn't yet exists in the years of the first two examples, but the offset of +00:53:28 is really strange. Any idea where this offset "+00:53:28" comes from?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Because history.

On April 1st, 1893, the time zone was adjusted from Local Mean Time (LMT), a local time zone (which was common at that time), to Central European Time (CET), adjusting the clock by 6 minutes and 32 seconds.

Timezones are regularly changed due to political decisions, but those strange amounts like 6 minutes and 32 seconds are often the result of moving from a local mean time to a standardized time.

Many known historical changes are found at timeanddate.com, and Berlin specifically at https://www.timeanddate.com/time/zone/germany/berlin.

over 4 years ago · Santiago Trujillo Denunciar

0

Timezones, Daylight Saving, and all those annoying and fancy features, did not exist at the beginning of the 20th century.

There were many "variations" of the time, like the infamous Dutch Time which was about 19 minutes ahead of UTC, mostly based on the clock of a tower which was simply that amount of time ahead.

I don't know exactly where the time difference comes from in the case of Germany and Berlin, but it's a known offset (likely based on similar reasons as the Dutch Time).

You can see how it has evolved over time.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda