*
The moose likes Java in General and the fly likes Having problem getting GMT off set properly on the Daylight saving switching days Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Having problem getting GMT off set properly on the Daylight saving switching days" Watch "Having problem getting GMT off set properly on the Daylight saving switching days" New topic
Author

Having problem getting GMT off set properly on the Daylight saving switching days

Raj Shank
Greenhorn

Joined: Jan 02, 2005
Posts: 4
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.
veerabahu Subramanian
Greenhorn

Joined: Jun 01, 2007
Posts: 17
How about the system clock. Does it properly change during the transition time. if not you have to think of in that angle.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Having problem getting GMT off set properly on the Daylight saving switching days