• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about the system clock. Does it properly change during the transition time. if not you have to think of in that angle.
 
The human mind is a dangerous plaything. This tiny ad is pretty safe:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic