A cron expression names recurring civil clock times in five ordered fields
Classic Vixie-style cron strings march from left to right through minute, hour, day of month, month, and day of week. Each position is its own mini language: * means every value in that field, / introduces a step, - spans an inclusive range, and , lists separate choices. The string does not store a time zone and does not count seconds since an epoch; it repeats a pattern on the civil calendar. That makes cron the right model for nightly backups and weekly reports, while a Unix second count on timestamp names one instant and JWT NumericDate claims such as exp on JWT encode expiry in those seconds.
Most production schedulers that people call cron still expect exactly five fields. Linux crontab, Kubernetes CronJob schedule, GitHub Actions workflow schedule, and many cloud consoles document minute-through-week ordering without a leading seconds column. Quartz-style schedulers and some Java frameworks add a sixth seconds field ahead of minute, and optional seventh year tokens appear in advanced dialects. Dropping the seconds column when you paste into crontab makes a job fire a minute late or on the wrong cadence; adding seconds where the engine expects only five makes the parser reject the line or mis-read the first token as a minute.
Unless documentation states otherwise, the clock behind the five fields is UTC. A line that reads 0 9 * * * fires at nine in the morning UTC, not at nine on your office wall clock. Daylight saving and regional offsets therefore change how a cron line reads in each region even when the expression is unchanged. Preview the next run instants in UTC before you ship a schedule, and line up one-off deadlines with epoch seconds on timestamp when you compare against token expiry checked on JWT.
Field order, wildcards, five versus six columns, and which clock the pattern uses
Why the minute field sits left of hour in standard five-field cron dialects
- POSIX and Vixie crontab lists minute before hour so the finest grain of the repeat sits in the leftmost slot.
- A line 30 14 * * * means minute thirty of hour fourteen, that is 14:30 on the civil clock the engine uses.
- Reversing the two numbers to hour-then-minute matches Quartz documentation by accident but breaks crontab and Kubernetes.
- When you read a foreign expression aloud, always say minute first, then hour, then calendar anchors.
What * / , and - mean inside each cron field position
- * accepts every legal value for that field without narrowing the repeat.
- / after a range or * runs every N units, as in */5 in the minute field for every five minutes.
- - joins inclusive bounds, such as 9-17 for business-hour hours only.
- , separates independent alternatives, such as 1,15,30 for three minute marks within the hour.
How day-of-month and day-of-week restrictions combine when both are narrowed
- Classic cron treats day-of-month and day-of-week as two filters on the same firing set when both are restricted.
- On many Vixie implementations, if either field is *, the other field alone decides eligible days.
- When both fields are lists or ranges, a day must satisfy both filters, which can shrink matches more than newcomers expect.
- Read your platform manual because Kubernetes, GitHub Actions, and systemd timers inherit slightly different union rules.
Why Kubernetes CronJob schedules and GitHub Actions timers document five UTC fields
- Kubernetes CronJob schedule strings follow the standard minute-hour-dom-month-dow shape without seconds.
- GitHub Actions workflow schedule uses the same five-position grammar and evaluates it in UTC.
- Linux crontab on the server uses five fields and the system clock context the daemon documents, often UTC on cloud images.
- Quartz six-field schedules with a leading seconds column belong in JVM config, not in those five-field surfaces.
Where the line looks valid but fires at the wrong civil time
A nightly job that hits office noon on the wall because the host assumed UTC while operators thought in civil office time
Five-field cron never embeds a region offset. 0 9 * * * is 09:00 UTC. Teams in UTC+8 see 17:00 unless they move the hour field. Map the intended wall clock to UTC before you edit the line, and compare the next run list against epoch output on timestamp.
A Spring Quartz six-field line pasted into crontab or a Kubernetes manifest unchanged
Quartz prepends seconds, so 0 0 30 * * * can mean second zero, minute zero, minute thirty in different parsers. Kubernetes reads the first token as minute and may treat the line as invalid. Strip or add the seconds column to match the target engine before deployment.
A GitHub Actions workflow that skips weekends because day-of-week used one while day-of-month also narrowed
Restricting both dom and dow shrinks matches on POSIX-flavored parsers. dom 1 with dow 1-5 is not the same as dow 1-5 alone. Re-read union rules in Actions docs, simplify one field to *, and re-check the next fires in UTC.
Frequently asked questions
How do I parse a cron expression online?
What do the five cron fields mean?
Is minute or hour first in cron?
What is a Quartz six-field cron expression?
What time zone does cron use?
How do I write crontab every five minutes?
What schedule format does Kubernetes CronJob use?
How does GitHub Actions cron differ from JWT exp timing?
Common crontab examples (5 fields)
*/5 * * * *Every 5 minutes0 */2 * * *Every 2 hours at minute 030 8 * * *Every day at 08:300 12 * * *Every day at 12:000 2 * * *Every day at 02:00 (typical backup window)0 9 * * 1-5Weekdays (Mon–Fri) at 09:000 0 1 * *Midnight on the 1st of each month0 0 * * 0Midnight every Sunday