date - End of DayLight Saving Time Issue in java -
i trying find how dst works,for have written sample of code talks dst,i wonder why timezone changes @ 1:00am per understanding dst end 03 november 2013 @ 2:00am @ 2:00am should give 1:00am timezone should chnaged, not that. can me out of this...
public static void main(string[] args) throws interruptedexception { timezone.setdefault(timezone.gettimezone("america/los_angeles")); dateformat fmt = new simpledateformat("dd-mm-yy hh:mm:ss zz"); calendar cal = calendar.getinstance(); cal.set(2013, 10, 03, 0, 59, 59); system.out.println(fmt.format(cal.gettime())); cal.set(2013, 10, 03, 1, 0, 0); system.out.println(fmt.format(cal.gettime())); }
output:
03-11-13 00:59:59 pdt 03-11-13 01:00:00 pst
01:00 happens twice, once in pdt , once (an hour later) in pst.
if tell calendar 01:00 on date of time change, class identifies input corresponds 2 distinct possible times, , arbitrarily uses 1 of them.
Comments
Post a Comment