Cron expression for the last day of the month

Runs the job at midnight on the last day of every month, whatever that day is.

0 0 L * *

Generator

At 12:00 AM, on the last day of the month

Field by field

  • Minute · 0–59 0 only at minute 0
  • Hour · 0–23 0 only at 00:00
  • Day of month · 1–31 L the last day of the month
  • Month · 1–12 or JAN–DEC * every month
  • Day of week · 0–7 or SUN–SAT * every day of the week

Next runs in your local time

    Where this cron expression shows up

    • Month-end closing: invoices and reports that have to land in the month being closed
    • Archiving or clearing data before the calendar flips to a new month
    • A final metrics rollup for the month that just ended

    Common variations

    • The same day, at 23:00 instead of midnight

      0 23 L * * At 11:00 PM, on the last day of the month

    • For schedulers without L (classic crontab): fires on the 28th, 29th and 30th too, so the job itself must check that tomorrow is the 1st

      0 0 28-31 * * At 12:00 AM, between day 28 and 31 of the month

    • The first day of the month instead

      0 0 1 * * At 12:00 AM, on day 1 of the month

    L is the last day of the month. Quartz and cron-parser understand it; the Vixie cron that ships with most Linux systems does not, so a crontab entry needs the guarded 28-31 version above. Writing 28-31 on its own is the trap: it fires on three days in a 31-day month and on two in February.

    Ranges, steps, and names are spelled out on the cheat sheet.