opyebCronPulse

Five-field Unix cron versus six-field Quartz and EventBridge

Cron basics · 7 min read

One-line answer: Seconds, weekday numbers, the ? rule and the year field: what changes when you move a schedule between cron dialects.

“Cron” is not one format. Linux crontab uses five fields, Quartz and Spring use six with seconds, and AWS EventBridge uses six with a year. The same string pasted into a different product can run at a completely different time.

FormatField orderWeekday numbersDistinctive rule
Unix/Vixiemin hour day month weekday0 = Sundayday and weekday combine with OR
Quartz/Springsec min hour day month weekday1 = Sundayone of day/weekday must be ?; L, W, #
AWS EventBridgemin hour day month weekday year1 = Sundayyear field required, no seconds

What the seconds field changes

Quartz's 0 0 9 * * ? is 09:00:00 every day. Pasted into five-field Unix cron it has one field too many and fails. The reverse is just as bad: Unix's 0 9 * * * in Quartz is read as second 0, minute 9, hour … and shifts every value. When converting, count the fields first.

The year field

AWS EventBridge cron ends with a year, as in 0 9 * * ? 2026, meaning 09:00 every day in 2026 only. Quartz can also add a year as a seventh field. CronPulse treats a six-field expression whose last token contains a four-digit year as EventBridge, and otherwise as Quartz.

AND versus OR for day and weekday

Unix treats day-of-month and day-of-week as OR when both are restricted. Quartz expects one of them to be ?, so only the other applies. 0 0 12 ? * MON-FRI is noon on weekdays; 0 0 12 15 * ? is noon on the 15th. Neither expresses “the 15th if it is a weekday” without extra logic.

Converting the same job

Unix        0 9 * * 1-5          weekdays 09:00
Quartz      0 0 9 ? * MON-FRI    weekdays 09:00
EventBridge 0 9 ? * MON-FRI *    weekdays 09:00

All three describe one job, yet all three strings differ. Whenever a schedule is written down, record the dialect next to it; that one habit prevents most migration incidents.

Paste an expression and see its next run times right away.

Open CronPulse

Frequently asked questions

What does Spring's `@Scheduled(cron = "0 0 9 * * ?")` mean?

Seconds, minutes, hours, day, month, weekday: 09:00:00 every day. Spring uses the server's local time zone unless the zone attribute names an IANA zone.

Can EventBridge run a job every few seconds?

No. EventBridge schedules are minute-granular. For sub-minute precision you need Step Functions, an application timer, or another scheduler alongside it.

Sources

Related reading