Convert Quartz to Unix cron

Going down to five fields loses things. See exactly what, with a workaround for each and a run-by-run comparison.

Dialect set manually: Quartz.
NATIVE exact Quartz
0Secondat second 0
0Minuteat minute 0
18Hourthe 18:xx hour
?Day of monthany day
*Monthevery month
6LDay of weekthe last Friday of the month

At 18:00, on the last Friday of the month.

  • Times are in UTC.

Loading the simulator…

Lossy by nature

Unix cron has no seconds, no year, and none of Quartz’s L, W or # operators. The example — 18:00 on the last Friday of each month — has no crontab equivalent. CronViewer shows the closest expression, marks the conversion “not equivalent”, and gives the usual workaround: run every Friday at 18:00 and let the command exit unless next week is a different month. systemd OnCalendar can express it exactly (Fri *-*~07/1 18:00), so check that target too.

For expressions that do convert, weekday numbers are shifted back (Quartz 2-6 → Unix 1-5), “?” becomes “*”, and the equivalence check confirms the result. Seconds other than 0 and specific years are reported as lossy rather than silently dropped.

Try these

Questions

How do I run on the last day of the month in crontab?

Use 0 23 28-31 * * with a guard: [ "$(date -d tomorrow +%d)" = "01" ] && command. (Escape % as \% inside crontab.) On macOS/BSD use date -v+1d +%d.

Can Kubernetes CronJobs use Quartz syntax?

No. Kubernetes uses five-field cron (robfig/cron) without L, W or #.