Last of the Month Cron Expression
Runs on the last day of every month — Unix vs Quartz approaches.
Expression
0 0 28-31 * *Try it in the tester →Field Breakdown
0
minute
0
hour
28-31
day-of-month
*
month
*
day-of-week
minuteat minute 0
hourat midnight
day-of-monthdays 28 through 31
monthevery month (1–12)
day-of-weekevery weekday (0=Sun – 6=Sat)
How It Works
Standard Unix cron has no native “last day” token, so the common workaround is `0 0 28-31 * *` combined with a script that checks `date -d tomorrow +%d` == 01. Quartz has a dedicated `L` token: use `0 0 0 L * ?` instead.
Example Run Times
- Jan 28 00:00:00
- Jan 29 00:00:00
- Jan 30 00:00:00
- Jan 31 00:00:00
- Feb 28 00:00:00
Frequently Asked Questions
Why does Unix cron not support `L`?
`L` (last) is a Quartz extension. Unix cron has minute-granular pattern matching only — no “relative to month end” token. The classic workaround is a shell guard inside the job.
What is the Quartz equivalent?
`0 0 0 L * ?` — fires at midnight on the last day of every month, automatically handling 28/29/30/31.