Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GregorianCalendar()

 
Diksha Neel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Maneesh Godbole
Saloon Keeper
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic