This document replaces the outdated article with the ID 27R339 and the title How are Jobs executed when the daylight saving time is switched on or off?
This article provides information on how the switch to and from the daylight saving time affects scheduled jobs.
In many parts of the world there is a change in the time settings twice a year. In spring, daylight saving time is switched on. The clock is moved forward by one hour in the early morning. In fall, daylight saving time is switched off and one early morning hour is repeated by setting the clock back.
On which day this happens, which hour is left out in spring and which is repeated in fall differs depending on the time zones. Our application relies on the ability of Java to handle dates including different time zones correctly. The standard date and time are received from the operating system.
However, Java makes its own calculations of the daylight saving settings according to rules which are part of the program and do not receive this information from the operating system. To have all current changes in your time zone applied, make sure to keep the java time zone classes up to date (for details about how to do it, please refer to Java support).
Often the following question occurs: What happens to jobs that are scheduled to run during the time shift?
As an example, the shifts between Central European Time (CET = UTC+01:00) and Central European Summer Time (CEST = UTC+2:00) were selected.
During this time shift in spring, the clock is moved forward from the last moment of 1:59 am to 3:00 am. In fall, the clock is moved back at the end of 2:59 am to 2:00 am, so that the hour between 2 and 3 is repeated.
The question that now arises is: How is a job executed that is scheduled to run between 2 am and 3 am on these special days?
The explanation applies in the same way to other daylight saving time related shifts in other time zones.
On the day when daylight saving time is switched on, the jobs are not running at all in the interval that includes the hour from 2 am to 3 am. A job that is scheduled to run every day would not be executed on this day. On the day when daylight saving time is switched off, the jobs will run twice - one time according to the setting in daylight saving time, and one hour later again, when the same time is reached according to the "normal" time.
Example:
It is not possible to configure a job to run between 2 and 3 am on the day when daylight saving time is switched on (no error is thrown, but the time is automatically converted into a start time one hour ahead - so 2:15 am will become 3:15 am, when you saved the job). At the shift back to "normal" time, a job can be scheduled to run between 2:00 am and 3:00 am. These jobs will run only one time on this day - after the clock was set back to "normal".
Example:
So, if you have jobs which run on a regular basis that get you into trouble when executed twice, or if they are left out for one interval, better do not schedule them to start between 2.00 and 3:00 am. Jobs that are scheduled to run once need no special attention.
We have a job timer that checks all enabled jobs every minute. With the given job condition, it is checked if the job should be started in this minute or not.
For the intermittent time condition we check the next start date based on the configured start date. Here, the daylight saving time settings are taken into account for now and for the configured start date (job interval start date + run time) - to ensure that the jobs that are scheduled to run at (for example) 5 o'clock will do so, no matter if it is winter or summer.
The same applies to times between 2 and 3 am. So during the change in spring conditions, this time span will not be met at all. On the day when time is changed back, there will be two times.
For the relative time condition the check is easier - the date is simply stored and checked in UTC and so the time condition is only met once.