Cron for the last day of month
Month-end schedules are tricky because cron support differs by platform. Some engines support L for "last day", while standard 5-field cron often does not.
Common month-end patterns
- 0 0 L * * → last day at 00:00 (only if your scheduler supports L)
- 0 0 28-31 * * + guard clause → portable fallback across basic cron engines
- 0 23 28-31 * * + timezone pinning → safer for end-of-day reporting windows
Portable fallback strategy
- Schedule on days 28-31 at your desired time.
- Pin scheduler timezone explicitly (UTC or your business timezone).
- In code, run only when today is the actual month-end date.
- Keep the job idempotent so retries do not duplicate side effects.
Quick check: test February (including leap years), 30-day months, and 31-day months before shipping month-end automations.
If your runtime supports calendar-aware scheduling (instead of plain cron), prefer it for billing and financial cutoffs. Otherwise, the 28-31 + guard approach is the most reliable cross-platform option.
Continue with related guides
Browse the full guides hub or open the Cron scheduler tool.