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

FieldValueMeaning
Minute0At 0
Hour0At 0
Day of Month31At 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

**/5*/10*/15*/300
**/2*/3*/6*/120
*1151,15*/2
*11,4,7,101,7
*1-50,615

Next 10 Executions

1.Tue, Mar 31, 2026, 12:00 AM
2.Sun, May 31, 2026, 12:00 AM
3.Fri, Jul 31, 2026, 12:00 AM
4.Mon, Aug 31, 2026, 12:00 AM
5.Sat, Oct 31, 2026, 12:00 AM
6.Thu, Dec 31, 2026, 12:00 AM
7.Sun, Jan 31, 2027, 12:00 AM
8.Wed, Mar 31, 2027, 12:00 AM
9.Mon, May 31, 2027, 12:00 AM
10.Sat, Jul 31, 2027, 12:00 AM

Ctrl+Shift+C to copy expression

Customize this expression