schedulingdevops
Cron Expressions, Demystified
A field-by-field breakdown of cron syntax with the edge cases that bite people in production.
Astound1 min read
Cron looks cryptic until you learn the one rule it follows: five fields, left to right, smallest unit to largest.
The five fields
# ┌──────── minute (0-59)
# │ ┌────── hour (0-23)
# │ │ ┌──── day of month (1-31)
# │ │ │ ┌── month (1-12)
# │ │ │ │ ─ day of week (0-7, 0 and 7 are Sunday)
# │ │ │ │
* * * * *
| Field | Allowed | Wildcards |
|---|---|---|
| Minute | 0-59 | * , - / |
| Hour | 0-23 | * , - / |
| Day of month | 1-31 | * , - / ? |
| Month | 1-12 | * , - / |
| Day of week | 0-7 | * , - / ? |
Common gotchas
0 0 * * 0runs at midnight on Sunday, not Monday.- Day-of-month and day-of-week are OR'd, not AND'd.
0 0 1 * 1fires on the 1st and every Monday. */5in the minute field means "every 5 minutes from the top of the hour", stepping on the hour boundary.
Use the Cron Builder to generate these visually and copy the verified expression — no off-by-one surprises.