Cron Midnight on 1st and Last Day of Month

0 0 1,28-31 * *

On day 1st, 28th, 29th, 30th, 31st of every month at 12:00 AM

Next 10 Executions

Times shown in UTC

  • Thu, May 28, 202600:00
  • Fri, May 29, 202600:00
  • Sat, May 30, 202600:00
  • Sun, May 31, 202600:00
  • Mon, Jun 1, 202600:00
  • Sun, Jun 28, 202600:00
  • Mon, Jun 29, 202600:00
  • Tue, Jun 30, 202600:00
  • Wed, Jul 1, 202600:00
  • Tue, Jul 28, 202600:00

Field Breakdown

0
Minute
0
0
Hour
0
1,28-31
Day of Month
1,28-31
*
Month
Every month
*
Day of Week
Every day of week

About This Schedule

Running a cron job on the "first and last day of the month" is tricky because months have different lengths (28-31 days). There's no direct "last day" syntax in standard cron. One approach is 0 0 1,28-31 * * combined with application logic to check if today is actually the last day.

A simpler method uses two cron entries: one for the first (0 0 1 * *) and a script for the last day that checks: [ "$(date -d tomorrow +%d)" = "01" ] && run_job. The Quartz scheduler supports L in the day-of-month field: 0 0 1,L * ? runs on the 1st and last day directly.

This pattern is common for month-opening and month-closing financial operations, beginning and end of month reporting, and billing cycle boundaries. The first day starts new month processing while the last day closes out the current month.

Frequently Asked Questions