Convert Unix cron (POSIX/Vixie) to Quartz
Translate POSIX/Vixie crontab expressions to Quartz scheduler format: seconds field, Sunday renumbering (0→1), and the ?-token rule, with worked examples.
About this conversion
Moving a crontab entry into a Quartz scheduler (or a Java service that embeds one) is the classic wrong-day conversion. Quartz numbers Sunday as 1 where Unix cron numbers it 0, so every numeric day-of-week value shifts by one — a MON-FRI range copied digit-for-digit lands on the wrong days without a single error. Quartz also adds a seconds field at the front and enforces a rule Unix cron doesn't have: exactly one of day-of-month or day-of-week must opt out with ?.
What changes in this conversion
- Field count goes 5 → 6: a seconds field is prepended. A converted crontab expression fires at second 0.
- Numeric day-of-week values shift up by one (Sunday 0 → 1, so weekdays 1-5 become 2-6). Name tokens like MON-FRI mean the same days in both dialects and pass through unchanged.
- One of day-of-month / day-of-week must be ? in Quartz — the converter puts ? in whichever side your expression leaves unrestricted.
- @-aliases (@daily, @hourly) don't exist in Quartz; they're expanded to their field form before converting.
Worked examples
0 9 * * 1-5converts to0 0 9 ? * 2-6lossless*/15 * * * *converts to0 */15 * * * ?lossless@dailyconverts to0 0 0 * * ?lossless0 0 1-7 * 1converts to0 0 0 1-7 * ?lossy- ⚠ POSIX fires when day-of-month OR day-of-week matches; Quartz requires one — kept day-of-month (1-7), dropped day-of-week (1).
Every converted expression above is produced by the same conversion engine the tool uses — generated and integrity-tested, not hand-written.
Lossy and refused conversions
When a Unix expression restricts BOTH day-of-month and day-of-week, POSIX semantics fire on either match — a union Quartz cannot express, because its ? rule forces you to pick one side. The converter keeps the day-of-month restriction, drops day-of-week, and flags the conversion as lossy so you can decide which side actually mattered. If what you meant was "the first Monday of the month", Quartz can say that natively with the # token (2#1) — something Unix cron never could.
FAQ
Why did my weekday range change from 1-5 to 2-6?
Quartz is 1-indexed with Sunday = 1, so Monday–Friday is 2-6. Unix cron is 0-indexed with Sunday = 0, making Monday–Friday 1-5. The converter renumbers numeric values; day names are identical in both.
Does Quartz support @daily or @hourly?
No. Quartz has no @-aliases, so the converter expands them first — @daily becomes the midnight field form before translation.