Cron syntax compared: standard, Quartz, node-cron and EventBridge
Four dialects that look interchangeable and are not. A field-by-field comparison, and the two differences that make a copied expression run at the wrong time.
Frequently asked questions
Why does my cron expression work in one system and not another?
Almost always the field count. Standard cron takes five fields, node-cron takes five or six, Quartz takes six or seven, and EventBridge takes exactly six. Add or remove a field and every value shifts position — an hour becomes a day-of-month, a day becomes a month.
Is Monday 1 or 2?
Both, depending. Standard cron and node-cron number Sunday as 0 (and also accept 7), so Monday is 1. Quartz and EventBridge number Sunday as 1, so Monday is 2. This is the difference that causes a copied expression to run a day early while parsing perfectly.
Why does Quartz need a question mark?
Because it refuses to inherit Unix cron’s OR rule, where restricting both day fields means "either matches". Quartz makes you say which of the two you are using by putting ? in the other. It is more verbose and less ambiguous.
Can I just use names instead of numbers?
Where the scheduler accepts them, yes, and you should. MON, TUE and JAN, FEB mean the same thing in every dialect, which removes the numbering trap entirely. Standard cron, node-cron, Quartz and EventBridge all accept the three-letter names.
Found a mistake on this page? Tell me — a page that is confidently wrong is worse than no page.