Cron Expressions and Time Zones
A cluster schedule's expression decides when it fires, and its timeZone decides which clock the expression is read against. Both are set when adding a schedule.
Cron expressions
expression is a Quartz cron expression with six fields, seconds minutes hours day-of-month month day-of-week, and an optional seventh for the year. Exactly one of day-of-month and day-of-week is specified; the other is ?. The Cron Trigger Tutorial covers the rest of the syntax.
A cluster schedule can fire at most once per hour: the seconds field must be a single integer, and the minutes field must be a single value rather than *, a range, a list, or a step. The other fields are unrestricted. An expression that breaks the rule is rejected when the schedule is added or altered.
| Expression | Fires |
|---|---|
0 0 7 ? * MON-FRI | 07:00 on weekdays |
0 30 22 * * ? | 22:30 every day |
0 0 0/6 * * ? | every six hours, on the hour |
0 0 1 1 * ? | 01:00 on the first day of each month |
Time zones
Without timeZone, the expression is evaluated in the scheduler's time zone, typically UTC. timeZone takes a Java time zone ID. A fixed-offset ID such as UTC keeps the schedule at the same instant all year; a region ID such as America/New_York follows that region's daylight saving changes, so the schedule stays at the same local time.
startTime and endTime are instants in ISO 8601 format with a Z suffix. timeZone does not affect them.