How to get correct time (Millisecond) with DST timezone in java -


i have simple problem:

timezone fromtimezone = timezone.gettimezone("america/santiago"); calendar calendar = calendar.getinstance(); calendar.set(calendar.hour_of_day, 8); calendar.set(calendar.minute, 45); calendar.set(calendar.second, 0); calendar.set(calendar.millisecond, 0); system.out.println(calendar.gettime() + " |mili: " + calendar.gettimeinmillis()); 

the output: (my timezone ict)

wed apr 01 19:45:00 ict 2015 |milisecond: 1427892300000 

the problem is: calendar return wrong time timezone on dst day. timezone "america/santiago" should utc-3 (ref: http://www.timeanddate.com/worldclock/chile/santiago.) . need show:

wed apr 01 18:45:00 ict 2015 |milisecond: 1427888700000 

you have not applied timezone fromtimezone calendar .


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -