posted 17 years ago
Hi folks,
I am using jdk 1.4.2_08. I downloaded the Timezone Updater 1.2.1 and installed it and I am trying to get the GMT shift for a Calendar object so that I can subtract the right time in milliseconds from the Calendar object as I have to send a object with the Timestamp as a parameter to a Webservice which expects Time in GMT. The DST shifting happens on the following day at 00:00:00 instead of the specified day at 02:00:00.
Here is what I am trying to do:
//****************************************
endTimestamp.set(2008, 10, 2, 23, 59, 59);
endTimestamp.getTime() before set:Sun Nov 02 23:59:59 PST 2008
endTimestamp.getTime().getTimezoneOffset() before set:480
one of my methods returns the offset.
GmtOffInMillis:-25200000
GmtOffInhours:-7
endTimestamp.getTime() after set:Sun Nov 02 23:59:59 PST 2008
endTimestamp.getTime() after clear & set:Sun Nov 02 16:59:59 PST 2008
---------------------
endTimestamp.set(2008, 10, 3, 0, 0, 0);
endTimestamp.getTime() before set:Mon Nov 03 00:00:00 PST 2008
endTimestamp.getTime().getTimezoneOffset() before set:480
GmtOffInMillis:-28800000
GmtOffInhours:-8
endTimestamp.getTime() after set:Mon Nov 03 00:00:00 PST 2008
endTimestamp.getTime() after clear & set:Sun Nov 02 16:00:00 PST 2008
//****************************************
I am calling a method that returns the GMT offset. It works fine on all otherdays except for the two days when it transitions from daylight saving to normal date and back
As you can see, the shifting should have happened at 2:00 AM on
Nov-02-2008, but it actually happens on Nov-03-2008 at 00:00:00.
I don't know if I am missing anything.
Thanks in advance for any help.