Cron → Quartz / EventBridge
Convert Unix cron to Quartz or AWS EventBridge expression form.
Overview
Convert a 5-field Unix cron expression into the 6-or-7-field forms used by Quartz Scheduler and AWS EventBridge, or translate back the other direction. The output highlights the structural differences (seconds field, day-of-month vs day-of-week mutual exclusion, year support) so you don't accidentally schedule something for the wrong moment.
It's for developers who target Java/.NET schedulers built on Quartz, or who write Terraform/CDK code that hands cron strings to AWS EventBridge. Reach for it any time you copy a cron expression from a Unix box to a Quartz-based job or vice versa - the syntax looks identical at a glance but has subtle, breaking differences.
How it works
Unix cron has 5 fields (minute, hour, day-of-month, month, day-of-week). Quartz cron has 6 or 7 fields - the first is seconds (typically 0), and Quartz adds an optional year field at the end. Quartz also requires exactly one of day-of-month or day-of-week to be ? (because OR semantics on both fields don't work in Quartz). AWS EventBridge uses a 6-field flavour that's almost identical to Quartz - same seconds-not-included rule but the year is required.
The converter inserts the leading 0 for seconds, swaps * for ? in whichever day field is unrestricted, and adjusts day-of-week numbering: Unix uses 0-6 with 0=Sunday; Quartz uses 1-7 with 1=Sunday.
Examples
- Unix to Quartz (every weekday at 9 AM):
Unix: 0 9 * * 1-5 Quartz: 0 0 9 ? * 2-6 - Unix to EventBridge (1st of month at midnight):
Unix: 0 0 1 * * EventBridge: 0 0 1 * ? * - Quartz to Unix (every 15 minutes):
Quartz: 0 */15 * ? * * Unix: */15 * * * * - Note the day-of-week shift:
Unix Sunday: 0 Quartz Sunday: 1
FAQ
Why does Quartz use ? instead of *?
In Quartz, you can't constrain both day-of-month and day-of-week at the same time - the spec demands a ? in one of them to say "no specific value." Unix cron treats both as OR, which Quartz designers considered ambiguous.
Does EventBridge support the year field?
Yes - EventBridge's 6-field expression always requires a year (or *). Quartz's year field is optional but commonly included.
Are weekday numbers really different?
Yes. Unix cron numbers Sun=0..Sat=6 (with 7 also meaning Sun). Quartz numbers Sun=1..Sat=7. Get this wrong and your "Friday" job runs on Thursday.
What about Google Cloud Scheduler?
GCS uses standard 5-field Unix cron with timezone support, so no conversion is needed when porting from Unix to Cloud Scheduler.