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

159
Visualizações
Timezone BST has wrong offset

Cannot understand why BST (UTC Offset: UTC +1) got offset +11 in following code. I would expect +1.

final String lastUpdated = "Mon Sep 27 18:29:00 BST 2021";
final DateTimeFormatter LAST_UPDATED_FORMATTER = DateTimeFormatter.ofPattern("EEE MMM dd HH:mm:ss z y").withLocale(Locale.UK);
ZonedDateTime zonedDateTime = ZonedDateTime.parse(lastUpdated, LAST_UPDATED_FORMATTER);
LocalDateTime localDateTime = zonedDateTime.withZoneSameInstant(ZoneId.of("UTC")).toLocalDateTime();
System.out.println(zonedDateTime.getOffset()); // +11:00; expected +1
System.out.println(localDateTime.toString());

Console output:

+11:00
2021-09-27T07:29

All is clear once is date in UTC:

final String lastUpdated = "Mon Sep 27 18:29:00 BST 2021";
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

That's what you get for using ambiguous abbreviations, I'm afraid. BST can mean different things, as shown here.

It looks like in this case it's being interpreted as Bougainville Standard Time, which is indeed UTC+11.

(Even within the UK, BST hasn't always meant British Summer Time. Between 1968 and 1971, BST meant "British Standard Time", although it was still GMT+1.)

Using abbreviations is "somewhat okay" for formatting, but should be avoided for parsing purposes where at all possible. If you're receiving data that you know will use it, and you know what it should mean, you're probably best off replacing it in the text before parsing.

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