Blog
Reading cron syntax without a lookup table
The five fields aren't as arbitrary as they look once you know the order.
Blog
The five fields aren't as arbitrary as they look once you know the order.
A standard cron expression has five fields, always in the same order: minute, hour, day-of-month, month, day-of-week. The trick to reading one quickly is remembering that order goes from smallest unit of time to largest, then day-of-week gets tacked on at the end as an alternate way to specify days.
0 9 * * 1-5 reads as: minute 0, hour 9, any day of month, any month, weekdays 1 through 5 (Monday–Friday). In plain English: 9:00 AM, Monday through Friday.
The symbols worth knowing: * means "every value" for that field. A comma (1,15) means a list of specific values. A hyphen (1-5) means an inclusive range. A slash (*/15) means "every N units" — */15 in the minute field means every 15 minutes.
One genuinely confusing part: if both day-of-month and day-of-week are specified as something other than *, most cron implementations treat it as OR, not AND — the job runs if either condition is met, not only when both are true. This trips people up constantly and is worth double-checking in your specific scheduler's docs if you're combining both fields.
The other thing cron expressions don't tell you on their own: timezone. The same expression can mean a different wall-clock time depending on how the server or scheduler is configured — worth confirming separately if a job seems to run at an unexpected hour.
If you'd rather not parse the fields by hand, the cron explainer turns an expression into a plain-English sentence automatically.