Cron Expression for the Last Day of the Month
Table of Contents
Standard 5-field cron does not have a built-in "last day of month" feature — months have different lengths (28-31 days), so there's no fixed day number that always means "last day." But there are several workarounds, and some platforms (Quartz, Spring Boot) support an L shorthand for exactly this purpose.
Use our free cron generator to build your base schedule, then apply the end-of-month pattern for your platform below.
Standard Cron Workaround for Last Day of Month
Standard cron doesn't support "last day of month" natively. The common workaround: schedule on day 28 and add a check inside the script that verifies whether tomorrow is a new month.
# Runs at midnight on days 28, 29, 30, 31 — script checks if it's the last day 0 0 28-31 * * /path/to/script.sh
The script checks if it's the last day:
#!/bin/bash
# Only run if today is the last day of the month
if [ "$(date -d tomorrow +%d)" = "01" ]; then
/path/to/actual-job.sh
fi
This works on Linux (GNU date). On macOS, use: [ "$(date -v+1d +%d)" = "01" ]
Spring Boot and Quartz: Using "L" for Last Day
Quartz scheduler and Spring Boot's @Scheduled support the L character in the day-of-month field to mean "last day of month." No workaround needed:
// Spring Boot @Scheduled: runs at midnight on last day of every month
@Scheduled(cron = "0 0 0 L * *")
public void endOfMonthJob() { ... }
// Quartz: same expression
"0 0 0 L * ?"
Spring Boot also supports last weekday of month with LW and last Friday with 5L (last Friday of the month) in the day-of-week field.
AWS EventBridge: Last Day of Month Scheduling
AWS EventBridge Scheduler (formerly CloudWatch Events) uses a 6-field cron format that also supports the L character:
# AWS EventBridge: runs at midnight on the last day of every month (UTC) cron(0 0 L * ? *)
AWS EventBridge requires ? in either the day-of-month or day-of-week field (not both). When using L for day-of-month, put ? for day-of-week.
End-of-Month Cron Across Platforms
| Platform | Expression | Notes |
|---|---|---|
| Linux/Mac crontab | 0 0 28-31 * * + script check | Workaround needed |
| Spring Boot @Scheduled | 0 0 0 L * * | L = last day, native support |
| Quartz | 0 0 0 L * ? | Native L support |
| AWS EventBridge | cron(0 0 L * ? *) | Native L support |
| Kubernetes CronJob | 0 0 28-31 * * + script check | Workaround needed |
| GitHub Actions | 0 0 28-31 * * + step condition | Workaround needed |
For platforms without native L support, the day 28-31 pattern with a script-level check is reliable and widely used. The logic is simple: run the check on days 28 through 31, and only proceed if tomorrow's date is the 1st — meaning today is the last day of the month.
Common End-of-Month Business Patterns
End-of-month cron jobs typically handle:
- Monthly invoicing: Generate and send invoices on the last business day
- Database archiving: Move month-old records to cold storage
- Report generation: Monthly summaries for stakeholders
- Subscription billing runs: Process monthly payments
- Metric aggregation: Roll up 30-day stats into monthly summaries
For "last business day of month" (not just last calendar day), you need a more involved script that also checks whether the last day falls on a weekend and adjusts backward to Friday if it does. Standard cron expressions can't express this logic — it belongs in the script, not the schedule.
Try It Free — No Signup Required
Runs 100% in your browser. No account, no install, no limits.
Open Free Cron GeneratorFrequently Asked Questions
Can standard cron run on the last day of the month?
Not directly. Standard 5-field cron has no "last day" feature because months have different lengths. The standard workaround is to schedule on days 28-31 and include a check in the script that exits early unless today is the last day (check if tomorrow is the 1st).
How does the "L" character work in cron expressions?
The L character (for "Last") is supported by Quartz scheduler, Spring Boot @Scheduled, and AWS EventBridge. In the day-of-month field, L means the last day of the current month. So "0 0 0 L * *" in Spring Boot means midnight on the last day of every month.
How do I schedule a cron job for the last business day of the month?
Standard cron cannot express "last business day of month" directly. Schedule on days 28-31 at your desired time, then add logic in your script: (1) check if it's the last day of the month, and (2) if the last day is Saturday or Sunday, only run on the preceding Friday.

