aspose file tools*
The moose likes Java in General and the fly likes GregorianCalendar() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "GregorianCalendar()" Watch "GregorianCalendar()" New topic
Author

GregorianCalendar()

Diksha Neel
Greenhorn

Joined: May 06, 2008
Posts: 5
I am using Java 1.4.2 and on trying to get the current time through public GregorianCalendar(TimeZone zone) I am getting a one hour time lag with respect to the system/local time. Does anyone have any idea about this?

Thanks!
Travis Hein
Ranch Hand

Joined: Jun 06, 2006
Posts: 161
it is possible this is related to the changing of the daylight savings clock change dates. I know there is a more technical word for that,

A couple years ago, the date when the clocks were supposed to be turned ahead in the spring was moved up, so any existing timezone rule data would still perform adjustments using the old days, making the time it returned be one hour ahead, or behind between the intervals of the old daylight savings day and the new one.

The solution is to update the timezone data files, but the official fix to the timzeone rules files for daylight savings adjustments in Java was not available to java until after Java 1.5.0 update 11 or so. do, or if it is even possible and would work.


Error: Keyboard not attached. Press F1 to continue.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

Try using the the java.util.Date.
That should bypass the locale settings.
I assume, since you have mentioned, current time as per system time, you are not interested in DST and other locale related stuff.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GregorianCalendar()