Skip to content

Last Day of Month

This expression approximates running on the last day of every month by running on days 28 through 31. Standard cron does not have a 'last day of month' feature, so this is a common workaround. Your script should check if tomorrow is the 1st to confirm it is actually the last day. Some cron implementations like Quartz support an L modifier for this purpose.

Cron Expression 0 0 28-31 * *

What is the cron expression for Last Day of Month?

The cron expression for Last Day of Month is 0 0 28-31 * *. This five-field cron schedule uses the format minute, hour, day-of-month, month, and day-of-week. This expression approximates running on the last day of every month by running on days 28 through 31. Standard cron does not have a 'last day of month' feature, so this is a common workaround. Your script should check if tomorrow is the 1st to confirm it is actually the last day. Some cron implementations like Quartz support an L modifier for this purpose. Common use cases include end-of-month reports and monthly invoice generation.

Field Breakdown

Field Value Meaning
Minute 0 At minute 0
Hour 0 At midnight
Day of Month 28-31 On days 28, 29, 30, and 31
Month * Every month
Day of Week * Any day of the week

Example Next Run Times

  1. 1. 2026-04-28 00:00
  2. 2. 2026-04-29 00:00
  3. 3. 2026-04-30 00:00
  4. 4. 2026-05-28 00:00
  5. 5. 2026-05-29 00:00

Common Use Cases

Frequently Asked Questions

Why does standard cron not support 'last day of month'?

Standard cron syntax only supports specific numbers, ranges, and step values for the day field. It has no concept of relative dates like 'last.' Extended cron implementations like Quartz and AWS EventBridge add L (last) support.

Will this run multiple times in months with more than 28 days?

Yes. In a 31-day month, this runs on the 28th, 29th, 30th, and 31st. Add a check in your script: if tomorrow's day is 1, it is the last day. Only execute the real work on the actual last day.

How do I handle February?

February has 28 days (29 in leap years). This expression will run on the 28th (and 29th in leap years) which covers the last day. Your script's date check handles the rest.

Related Cron Expressions

0 0 1 * * First Day of Month 0 0 1 1,4,7,10 * Every Quarter (Jan, Apr, Jul, Oct) 0 0 1 1 * Yearly on January 1

Related Reading

Cron Expression Guide: Syntax, Examples & Common Schedules → How to Generate UUID v4 in JavaScript →