L in day-of-month: last day
0 0 0 L * ? # Quartz: midnight on the last day of every month (seconds first) cron(0 0 L * ? *) # AWS: same (year last)
This handles months of different lengths automatically: fires on the 28th of February (29th in leap years), 30th of April, 31st of January, etc.
L in day-of-week: last weekday of the month
Format: dayL means "last day-of-week of the month":
| Expression | Meaning |
|---|---|
0 0 0 ? * 6L | Last Friday of every month at midnight (Quartz uses 1=Sun, so 6=Fri) |
0 0 0 ? * 1L | Last Sunday of every month |
0 0 17 ? * 6L | Last Friday of every month at 5 PM |
0 0 0 ? * L | In Quartz, L alone in day-of-week means 7 (Saturday): every Saturday, not the last one. Spring rejects it |
L with offset: Nth-from-last
Some implementations support L-N meaning "N days before the last day":
0 0 0 L-1 * ? # Day before the last day of every month 0 0 0 L-3 * ? # 3 days before the last day
This is less universally supported: verify with your specific scheduler.
Unix cron workaround
Unix cron has no native "last day of month" support. Common workarounds:
# Approach 1: schedule for 28-31, gate inside the script 0 0 28-31 * * [ "$(date -d tomorrow +\%d)" = "01" ] && /path/to/script.sh # Approach 2: schedule on day 1, run yesterday's task 0 1 1 * * /path/to/script.sh --process-yesterday
The first approach is more direct ("run on last day"); the second is often more reliable because it treats the schedule as "run once per month, after the prior month is complete."
Last weekday of the month (Unix)
To run on the last weekday, gate on day-of-week inside the script:
# Every Friday at 5 PM, but only act if a week later is next month (= last Friday) 0 17 * * 5 [ "$(date -d '+7 days' +\%d)" -le 7 ] && /path/to/script.sh
Don’t write 0 17 25-31 * 5: with both day fields set, cron runs on days 25-31 and on every Friday.
Or just use Quartz / AWS Scheduler: much cleaner.
Platform support summary
| Platform | Supports L? |
|---|---|
| Quartz | Yes (note: Quartz 2.5.0 skips months shorter than 31 days for L; fixed in 2.5.1) |
| AWS EventBridge / Scheduler | Yes, in day-of-month and day-of-week |
| Spring @Scheduled | Yes, since Spring 5.3 (its own parser; days are numbered 0-7 from Sunday, so 6L is the last Saturday in Spring but the last Friday in Quartz) |
| Unix crontab | No |
| Kubernetes CronJob | No (uses Unix cron) |
| GitHub Actions | No (uses Unix cron) |
| Azure Functions Timer | No (uses NCRONTAB) |
| Jenkins | No |