ReferenceEvents and execution

Cron syntax

The exact expression format Work on Repeat accepts, and how it is evaluated.

Schedules are five-field cron expressions evaluated in the routine's IANA timezone.

Fields

┌───────────── minute        0–59
│ ┌─────────── hour          0–23
│ │ ┌───────── day of month  1–31
│ │ │ ┌─────── month         1–12
│ │ │ │ ┌───── day of week   0–6 (Sunday = 0)
│ │ │ │ │
* * * * *

Exactly five fields are required. Expressions are validated on save, and one that cannot produce a future occurrence is rejected with 400 invalid_schedule.

Accepted characters

CharacterMeaningExample
*Every value* * * * *
,List0 9 * * 1,3,5
-Range0 9 * * 1-5
/Step*/15 * * * *
LLast0 9 L * *
#Nth weekday of the month0 9 * * 1#2
?No specific value0 9 ? * 1

Named months and weekdays (JAN, MON) are not accepted. Neither are six-field expressions with seconds, nor shorthand such as @daily or @weekly.

Field length is capped at 120 characters for the whole expression.

Common schedules

ExpressionFires
0 9 * * 109:00 every Monday
0 9 * * 1-509:00 on weekdays
30 7 * * *07:30 every day
0 */6 * * *Every six hours, on the hour
*/15 * * * *Every fifteen minutes
0 9 1 * *09:00 on the first of the month
0 9 L * *09:00 on the last day of the month
0 9 1 1,4,7,10 *09:00 on the first day of each quarter
0 11 * * 1,3,511:00 on Monday, Wednesday, and Friday
0 9 * * 1#209:00 on the second Monday of the month

Evaluation

The next occurrence is computed in the routine's timezone, not converted from UTC afterwards. A 09:00 schedule stays at 09:00 through daylight-saving transitions.

Two consequences are worth planning around:

  • Times inside the hour skipped by a spring-forward transition do not exist on that date. Avoid 02:0003:00 in zones that shift there.
  • Times inside a repeated fall-back hour exist twice on the local clock. The scheduler advances past an occurrence once claimed, so the routine runs once.

Where the timing is contractual, set the timezone to UTC.

Resolution

The operations tick runs once a minute, so a routine fires within a minute of its occurrence rather than at the exact second. Schedules finer than one minute are not meaningful.

On this page

Edit this page on GitHub