Run at 11:59 PM on December 31st | CronBase

cron expression Standard
$ 59 23 31 12 *

One minute before midnight on the final day of December every year.

This cron expression schedules a task to execute precisely at eleven fifty-nine PM on December thirty-first annually. It is widely used in production environments to perform critical year-end operations, final financial ledger closings, database archiving, and system state resets immediately before the calendar year transitions.

Minute
59
Hour
23
Day of Month
31
Month
12
Day of Week
*
How it works

Next 5 Runs

  • in 159d 3h
  • in 524d 3h
  • in 890d 3h
  • in 1255d 3h
  • in 1620d 3h

* Tools

Code & Implementations

Bash
#!/usr/bin/env bash
# Production-ready crontab installation script for year-end tasks
set -euo pipefail
CRON_EXPRESSION="59 23 31 12 *"
JOB_COMMAND="/usr/local/bin/year-end-cleanup.sh >> /var/log/cron-year-end.log 2>&1"
if [ ! -x "/usr/local/bin/year-end-cleanup.sh" ]; then
    echo "Error: Executable script /usr/local/bin/year-end-cleanup.sh not found." >&2
    exit 1
fi
(crontab -l 2>/dev/null | grep -v -F "$JOB_COMMAND"; echo "$CRON_EXPRESSION $JOB_COMMAND") | crontab -
echo "Successfully scheduled year-end job."
Setup notes

Save this script as setup-cron.sh, make it executable with chmod +x, and run it as root or the application user to install the year-end cron job safely.

Last verified:

Partner UptimeRobot

Keep this cron job monitored 24/7

UptimeRobot alerts you the moment a scheduled job stops responding. Free plan monitors up to 50 endpoints — no credit card required.

Platform Equivalents

AWS EventBridge

Standard cron expressions often need conversion for AWS EventBridge schedules.

EventBridge Rule
cron(59 23 31 12 ? *)

Systemd Timer

OnCalendar*-12-31 23:59:00

my-task.timer
[Unit]
Description=Timer for cron expression: 59 23 31 12 *

[Timer]
OnCalendar=*-12-31 23:59:00
Persistent=true

[Install]
WantedBy=timers.target

Last verified:

Frequently Asked Questions

What timezone does this cron expression run in?

By default, standard cron runs in the system's local timezone. It is highly recommended to configure your cron daemon or application runtime to use UTC to avoid issues with Daylight Saving Time shifts and server migrations.

How can I test a job that only runs once a year?

You can test the job by executing the underlying script manually in a staging environment, or by temporarily changing the cron expression to a near-future time (e.g., five minutes from now) to verify the end-to-end execution flow.

What happens if the server is offline at 11:59 PM on December 31st?

Standard cron will completely miss the execution. If your system was offline, the task will not run until the following year. To prevent this, use tools like Anacron, or design your job with monitoring that alerts on missed execution heartbeats.

Can I use this schedule to rotate log files?

While you can, using this schedule for log rotation is usually inefficient. Log rotation should happen much more frequently (daily or weekly) or based on file size. This schedule is better reserved for annual fiscal reports or year-end database partitioning.

How should I handle failures for a job that runs so infrequently?

Implement a robust dead-man's switch or external monitoring tool (like Healthchecks.io or Prometheus Pushgateway). If the job fails or does not report success by 00:15 AM on January 1st, it should trigger high-priority alerts to your on-call engineering team.

* Explore

Related expressions you might need

Last verified:

Was this helpful?