Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

342
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda