java - Issues to get end DayLight Saving time -


i trying check daylight saving time, using timezone. dst start on 10 march 2013 @ 2:00am , end on 3 november 2013 @ 2:00am. have forward clock 1 hour @ 2:00am , when end have clock 1 hour @ 2:00am. wanted check how time actual time @ 2:00am when dst end. working fine start of dst end of dst not working. here sample of code have tried:

timezone.setdefault(timezone.gettimezone("america/los_angeles")); calendar cal =calendar.getinstance(); if (timezone.getdefault().usedaylighttime()) { for(int = 0; i< 5 ; ++i) {      cal.set(2013,10,03,1,57+i,60);      long timemillis = cal.gettimeinmillis();      setcurrenttimeinmills(timemillis);      string formattime = dateformated(timemillis);      system.out.println(formattime);      } } 

output like:

03-11-2013 01:58:00 pst 03-11-2013 01:59:00 pst 03-11-2013 02:00:00 pst 03-11-2013 02:01:00 pst 03-11-2013 02:02:00 pst 

my java version :1.6.0_16. here datformated() user-define function view time in readable format , setcurrenttime() user-define method set current time.can me in why @ 1:59:60am time become 2:00am best of knowledge should 1:00am instead?

the code below shows timezone change pdt pst

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())); } 

outputs:

03-11-13 00:59:59 pdt 03-11-13 01:00:00 pst 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -