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

158
Vistas
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 Respuestas
Responde la pregunta

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 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