Skip to content
Unix cron100% Client-Side

Cron Expression for At 23:59 on Days 28-31 (Month-End Guard)

59 23 28-31 * *At 11:59 PM, between day 28 and 31 of the month

The Unix cron expression "59 23 28-31 * *" runs a task at 23:59 on days 28-31 (month-end guard). Preview the next run times in your timezone, read the plain-English translation, and copy ready-to-paste snippets for crontab, Node.js, GitHub Actions, and AWS EventBridge.

Live playground

  • Min59
  • Hour23
  • DOM28-31
  • Month*
  • DOW*

At 11:59 PM, between day 28 and 31 of the month

Unix cron · evaluated in UTC

24-hour view

Hover a highlighted hour for precise timestamps. Showing the next 50 executions.

Upcoming runs

Timezone

Runs are simulated in the selected IANA timezone. Auto-detected from your browser on first load.

Field breakdown

How each field of 59 23 28-31 * * is interpreted in the Unix cron format.

Field breakdown of 59 23 28-31 * *
FieldValueAllowedStatus
Minute590-59Valid
Hour230-23Valid
Day of Month28-311-31Valid
Month*1-12 or JAN-DECValid
Day of Week*0-7 or SUN-SAT (0 and 7 = SUN)Valid

Use “59 23 28-31 * *” in real code

Copy-paste configurations for the most common schedulers, converted to each platform’s dialect where needed.

import cron from 'node-cron';

cron.schedule('59 23 28-31 * *', () => {
  console.log('Running task...');
});

Running “59 23 28-31 * *” in production

The guard pattern: how five-field cron says 'last day of month'

59 23 28-31 * * fires at 23:59 on the 28th, 29th, 30th, and 31st of every month — four candidate nights — and the job's first line does the real scheduling: check whether tomorrow is the 1st, and exit immediately if it is not. On the 28th of February in a common year, tomorrow is March 1st, so the job runs and closes the month; on the 28th of a leap-year February, tomorrow is the 29th and the job exits, waiting for the following night; on April 28th-30th it exits nightly until the 30th, April's true last day. Cron supplies the candidate days — every possible month-end date — and the one-line calendar test selects the right one. It is the canonical workaround for five-field cron's most-cited missing feature.

Why the guard works as well as it does is worth appreciating: the day-of-month range 28-31 covers every possible final day (no month ends before the 28th; none after the 31st), and 23:59 places the fire inside the month being closed — a month-end job that ran at 00:00 would already belong to the next month. The trade-off is deliberate silence on non-final nights: three or four guard exits per month that monitoring must distinguish from failures. Log the exit path explicitly ('guard: tomorrow is not the 1st'), and alert on the job failing to reach that log line on candidate nights — the inverse of the usual alerting polarity, and the reason guard-pattern jobs need their runbooks updated, not just their crontabs.

When the dialect has an L: the native alternatives

The guard is the portable answer, but several dialects close the gap natively with the L modifier: Quartz fires the true last day with 0 0 0 L * ? (six fields, seconds leading, ? in day-of-week); AWS EventBridge takes cron(0 0 L * ? *) in its UTC-only six-field form — and this directory carries dedicated recipes for both; Salesforce Apex accepts 0 0 0 L * ? in System.schedule. Where L exists, it is the honest expression: the scheduler owns the calendar test, validation catches typos, and no candidate-night silence needs runbook explanation. systemd users get OnCalendar=*-*-*~1/1 or the 'last day' via calendar wildcards with more ceremony — the guard usually remains simpler.

The guard retains one durable advantage beyond portability: composability with month-end business logic. Because the job runs on the true last day at 23:59, it can close ledgers, stamp summaries, and snapshot 'as of' state with a documented inside-the-month position — and teams needing 'last business day' variants (skip weekends, roll to Friday) add that rule to the same guard in code, where it is testable. Dialect-native L cannot express last-business-day either; the calendar logic belongs to the job in every case. The simulator above shows the guard's candidate nights for the current month — including the ones it will silently skip.

Frequently asked questions

What does the cron expression "59 23 28-31 * *" mean?

"59 23 28-31 * *" is a Unix cron expression that means: At 11:59 PM, between day 28 and 31 of the month. It contains 5 fields — Minute (59), Hour (23), Day of Month (28-31), Month (*), Day of Week (*) — and works in any scheduler that accepts the Unix cron format.

How does "59 23 28-31 * *" behave in UTC versus local time?

The classic cron daemon interprets every field in the machine's local timezone (from /etc/timezone or the TZ environment variable). If the server runs in UTC the schedule fires in UTC; otherwise shift the hours accordingly. Modern cronie also supports CRON_TZ to pin a single job to UTC.

Can I combine "59 23 28-31 * *" with holidays or blackout dates?

Standard cron has no holiday awareness. The common pattern is to keep the schedule as-is and guard the job: check a holiday calendar when the run starts and exit early on excluded days. That keeps the schedule declarative while your code owns the policy.

Why does the month-end guard fire on days that aren't the last of the month?

By design — 28-31 are the candidate final dates, and the job's own check (is tomorrow the 1st?) makes the final decision. On April 28th, 29th, and 30th minus the last, the job exits immediately; it only executes real work when the calendar confirms the month is ending. This 'cron proposes, code disposes' structure exists because five-field cron has no last-day token; log the guard exits so monitoring can tell intentional no-ops from failures.

Is there a cron expression that fires on the last day directly, without the guard?

Not in five-field Unix cron — but dialects with the L modifier do it natively: Quartz 0 0 0 L * ?, AWS EventBridge cron(0 0 L * ? *), and Salesforce 0 0 0 L * ? in System.schedule all fire on the true final day (February 29th included in leap years). This directory has dedicated recipes for each. The 59 23 28-31 guard remains the portable form where only plain cron is available, and the only form that extends to rules like 'last business day' — that logic lives in the job regardless of dialect.

About the “59 23 28-31 * *” schedule

59 23 28-31 * * is the Unix cron way to say “At 11:59 PM, between day 28 and 31 of the month”. The simulator above evaluates it entirely in your browser — the timeline, the next-run table, and the timezone switcher all run client-side, so you can paste production schedules without them ever leaving your machine.

Every page in this directory follows the same structure: a plain-English translation, a per-field breakdown, platform-specific snippets, and a timezone-aware simulator. Move between the related intervals below to compare dialects, and validate one final time in the simulator with your own timezone before shipping.

Adjacent intervals and the same schedules expressed for other platforms.