Concept

What does L mean in cron?

The L means "last" — in the day-of-month field it's "last day of the month" (handling 28/29/30/31 correctly); in the day-of-week field it's "last X of the month." L only works in Quartz and AWS — standard Unix cron does NOT support it.

L in day-of-month — last day

0 0 L * ?       # Quartz: midnight on the last day of every month
cron(0 0 L * ? *)   # AWS: same

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":

ExpressionMeaning
0 0 0 ? * 6LLast Friday of every month at midnight (Quartz uses 1=Sun, so 6=Fri)
0 0 0 ? * 1LLast Sunday of every month
0 0 17 ? * 6LLast Friday of every month at 5 PM
0 0 0 ? * LLast day-of-week (Saturday by default)

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 robust 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:

# Try days 25-31, only run if it's the last Friday
0 17 25-31 * 5 [ "$(date -d 'next Friday' +\%d)" -le 7 ] && /path/to/script.sh

Or just use Quartz / AWS Scheduler — much cleaner.

Platform support summary

PlatformSupports L?
QuartzYes (full)
AWS EventBridge / SchedulerYes (full)
Spring @ScheduledYes (uses Quartz cron parser)
Unix crontabNo
Kubernetes CronJobNo (uses Unix cron)
GitHub ActionsNo (uses Unix cron)
Azure Functions TimerNo (uses NCRONTAB)
JenkinsNo
Related

Continue reading.