Skip to main content
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)
# │ │ │ │
  * * * * *
FieldAllowedWildcards
Minute0-59* , - /
Hour0-23* , - /
Day of month1-31* , - / ?
Month1-12* , - /
Day of week0-7* , - / ?

Common gotchas

  • 0 0 * * 0 runs at midnight on Sunday, not Monday.
  • Day-of-month and day-of-week are OR'd, not AND'd. 0 0 1 * 1 fires on the 1st and every Monday.
  • */5 in 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.

AstoundPart of the Astound Dev Tools writing on developer tools.