Question

I faced a weird problem with day light savings. I have a java program scheduled to run on every day on 00:05 AM time, but yesterday it ran on 23:05. I am using Gregorian calendar to schedule this program in java. It has never ran on 23:05 before this unless someone manually ran it. Does anyone know if this is issue with calendar?

Was it helpful?

Solution

That issue is almost certainly related to the daylight savings time switch, though it is odd that it should occur around midnight since the DST switch typically happens at 2 AM.

It's hard to say more without knowing what time zone your machine is set to and seeing your actual code.

OTHER TIPS

Isn't it related to day-light saving issues? The previous night the time was changed from summer time to winter time in some parts of the world.

At a best guess, this is running on an older version of Java, and it inappropriately thought that Daylight Saving Time started Sunday morning in the US.

Internally, Java stores the time as a GMT offset... specifically, the number of milliseconds since January 1, 1970 00:00:00.000 GMT (documented in the Calendar class's description).

If you don't want to update Java itself, you can still use the Timezone Updater Tool to update the Java timezones installed on the system.

Note: This was supposedly fixed in Java 5u6, unless you're in one of the other time zones mentioned in this list.

The World DST time vs the North American DST time are sometimes inconsistent.

In Europe the DST changes on the last Sunday of October. http://en.wikipedia.org/wiki/Daylight_saving_time_around_the_world#Europe

In North America DST changes on the first Sunday of November. http://en.wikipedia.org/wiki/Daylight_saving_time_around_the_world#North_America

Edit due to comments providing more accurate info.

I think, it ran at 00:05, but in "new"(winter) time it was 23:05.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top