23549

Question:
I've been facing some issues with timezone with Java since yesterday (21/10/2018). Looks like java is considering that daylight saving have taken place in Brazil but it hasn't.
I created the following test to be sure
public static void main(String[] args) {
ZonedDateTime dateTime = LocalDateTime.now().atZone(ZoneId.systemDefault());
System.out.println(dateTime);
ZonedDateTime saoPaulo = dateTime.withZoneSameInstant(ZoneId.of("America/Sao_Paulo"));
ZonedDateTime cuiba = dateTime.withZoneSameInstant(ZoneId.of("America/Cuiaba"));
ZonedDateTime rightTime = dateTime.withZoneSameInstant(ZoneId.of("GMT-4"));
System.out.println(saoPaulo);
System.out.println(cuiba);
System.out.println(rightTime);
}
That gave the following output
2018-10-22T09:55:34.473-02:00[America/Sao_Paulo]
2018-10-22T09:55:34.473-02:00[America/Sao_Paulo]
2018-10-22T08:55:34.473-03:00[America/Cuiaba]
2018-10-22T07:55:34.473-04:00[GMT-04:00]
That's wrong as the current timezone to São Paulo should be -03 and America/Cuiaba should be -04
Anyone knows what's the source of the timezone information on Java? There is something I can do on my side to fix that? I know that I can fix it by setting a fixed GMT offset but I'm not fond of it.
Answer1:The link posted by Jon Skeet helped me to solve my issue. Oracle had updated the daylight savings information on latest releases. After updating JDK version, it's working as expected.
2018-10-22T09:19:31.761-03:00[America/Sao_Paulo]
2018-10-22T09:19:31.761-03:00[America/Sao_Paulo]
2018-10-22T08:19:31.761-04:00[America/Cuiaba]
2018-10-22T08:19:31.761-04:00[GMT-04:00]