Skip to main content

Cron on the last day of every month

Question

How can I create a cron job that will run on the last day of every month?

Answer

There is no exact, portable five-field Unix cron expression for “the last day of every month.” Traditional Unix/Vixie cron, robfig/cron, Jenkins built-in cron, and NCrontab do not accept L. 0 0 L * * works with dragonmantank/cron-expression; Quartz and AWS EventBridge support L using their six-field forms. For Unix crontab, use 0 0 28-31 * * with the runtime guard below, so the command continues only when tomorrow is the first day of a month.

crontab
# dragonmantank/cron-expression only; Quartz and AWS need their six-field form
0 0 L * *
crontab
# portable trigger for a runtime "tomorrow is day 1" guard
0 0 28-31 * *
crontab
# the guarded crontab line (GNU date)
# on macOS/BSD use: date -v+1d +\%d
0 0 28-31 * * [ "$(date -d tomorrow +\%d)" = "01" ] && command

Read the guarded trigger field by field: minute 0, hour 0, days 28 through 31, every month, and every day of the week. Your runtime check narrows those four candidate nights to the one true month-end date. The month-enumeration approach you may have seen (0 0 30 4,6,9,11 * for 30-day months and 0 0 31 1,3,5,7,8,10,12 * for 31-day months) is correct for those months, but February breaks it: 28 runs a day early in leap years and 28,29 fires twice in them.

Run 0 0 L * * on Crontap
Three horizontal teal bars of different lengths, each ending in a yellow block, showing that months of 28, 30 and 31 days end on different dates.
Months are different lengths, so the last day lands on 28, 29, 30 or 31; a fixed day-of-month cannot follow it.
Why this matters

Month length changes, and February changes again in leap years. Treating February 28 as month-end runs a day early in leap years; listing both 28 and 29 runs twice in those years. Either mistake can close accounting periods, create reports, or rotate data on the wrong date. The candidate-days-plus-runtime-check pattern avoids that month-boundary error on any cron, while L avoids it only when your dialect implements the modifier. The dedicated guides cover Quartz, AWS EventBridge, robfig/cron, Jenkins, NCRONTAB and PHP cron-expression.

Read the dedicated guide: Cron expression for the last day of the month.

Cron schedules used

What it does

0 0 L * * — command

At 00:00, on the last day of the month.

Calendar

View future cron matches in a calendar

September 2026 · UTC

0 runs

0 0 28-31 * * — command

At 00:00, between day 28 and 31 of the month.

See this cron expression on the calendar view example

Write the cron here. Run it on Crontap.

Point Crontap at any URL. Pick any cron. Done.

WordPress, Shopify, Railway, Cloud Run, Vercel, HubSpot, Ghost, your own box. If it answers HTTP, Crontap can drive it on a clock you can read, in the timezone that actually matters, and page you when something breaks.

1.9k+ teams · Free forever tier · No credit card

Permalink: https://tool.crontap.com/help/cron-job-expression-every-last-day-of-the-month