Cron on the 31st of Every Month
Schedule a cron job on the 31st of every month at midnight using 0 0 31 * *. Field breakdown explaining which months trigger and edge case behavior.
Cron Expression
0 0 31 * *
Field Breakdown
| Field | Value | Meaning |
|---|---|---|
| Minute | 0 | At 0 |
| Hour | 0 | At 0 |
| Day of Month | 31 | At 31 |
| Month | * | Every month (1–12) |
| Day of Week | * | Every day of the week (Sun–Sat) |
Detailed Explanation
The cron expression 0 0 31 * * schedules a task to run at midnight on the 31st day of every month that has 31 days.
Field-by-field breakdown:
0(Minute): At minute 0. The task fires at the top of the hour.0(Hour): At hour 0 (midnight / 12 AM). The task runs at the start of the day.31(Day of Month): On the 31st day of the month only. This day only exists in months with 31 days.*(Month): Every month from January through December. The wildcard includes all months, but the task will only actually fire in months that have a 31st day.*(Day of Week): Every day of the week. No restriction on the day.
This means your task will execute only 7 times per year, in the months that have 31 days: January, March, May, July, August, October, and December. Months with 30 days (April, June, September, November) and February (28 or 29 days) are automatically skipped because the 31st simply does not exist. This is an important edge case to understand: cron silently skips execution when a specified day does not exist in the current month. This behavior can be useful if you intentionally want a schedule that only runs in long months, or it can be a gotcha if you expected monthly execution. For true end-of-month scheduling, see the last-day-of-month pattern. This expression is supported by standard cron on Linux/macOS, as well as cloud services like AWS CloudWatch, Google Cloud Scheduler, and GitHub Actions.
Use Case
Useful as a learning exercise to understand cron day-of-month edge cases, or for tasks that genuinely should only run in 31-day months like quarterly-adjacent processing.
Try It — Interactive Builder
On day 31 of every month at midnight
Next 10 Executions
Ctrl+Shift+C to copy expression