Shooting time zones when making dates in Joda's time

TZ on my comp is GMT + 5.

final DateTime date1 = dtf.parseDateTime("1979-04-29"); final DateTime date2 = dtf.parseDateTime("1979-05-12"); final DateTime date3 = dtf.parseDateTime("1979-04-02"); final DateTime date4 = dtf.parseDateTime("1979-04-15"); System.err.println(date1.toString()); System.err.println(date2.toString()); System.err.println(date3.toString()); System.err.println(date4.toString()); 

Exit

 1979-04-29T00:00:00.000-05:00 1979-05-12T00:00:00.000-04:00 1979-04-02T00:00:00.000-05:00 1979-04-15T00:00:00.000-05:00 

-04? Why?

If add

 DateTimeZone.setDefault(DateTimeZone.forID("Etc/GMT+5")); 

earlier, then the conclusion will be

 1979-04-29T00:00:00.000-05:00 1979-05-12T00:00:00.000-05:00 1979-04-02T00:00:00.000-05:00 1979-04-15T00:00:00.000-05:00 
+4
source share
1 answer

This is called Daylight Saving: http://timeanddate.com/time/dst/1979.html

At 02:00 on 1979-04-29 he changed to -04:00

+3
source

Source: https://habr.com/ru/post/1400177/


All Articles