Skip to content
SpringCronTools

guide

Spring Cron Timezones and DST

A cron expression has no timezone of its own. In Spring, the schedule is evaluated in the JVM default timezone unless you say otherwise, which is why the same expression behaves differently on two servers.

Pin the zone explicitly

@Scheduled accepts a zone attribute with any IANA timezone id. Setting it makes the schedule independent of the server configuration.

@Scheduled(cron = "0 0 9 * * MON-FRI", zone = "Europe/Berlin")

DST is a wall-clock schedule

Cron matches local calendar time, not elapsed hours. When a timezone switches to daylight saving time, the local clock jumps forward, so a 02:30 job may not exist on that day; when the clock falls back, the same local time happens twice.

In this tool, a local time that does not exist is skipped rather than silently shifted, which matches how a wall-clock schedule should behave.

Midnight jobs and zone changes

Some zones (for example America/Santiago) skip midnight on the transition day. A "0 0 0 * * *" job will not run on that date, because there is no midnight to run at.

nextRelated guides

nextRelated tools

Questions

Which timezone does Spring use by default?

The JVM default timezone of the server unless the zone attribute is set. That is why the same @Scheduled expression can fire at different moments on different machines.

What happens to a 02:30 job on a DST spring-forward day?

On a day where 02:30 does not exist locally, the run is skipped. Cron matches local time, so there is nothing to match.

referencesSources

A Spring cron expression is six space-separated fields — second, minute, hour, day-of-month, month, day-of-week — read left to right.
Field order per the CronExpression reference; the wording here is this site's, not a quotation from it.

Found a rule this site gets wrong? The parser is one file: the six-field reference lists every construct it accepts.