Skip to content
Webmaster Tools
Dev utilitiesCron ParserEvery day at midnight

Cron every day at midnight

The cron expression for every day at midnight is 0 0 * * *, the same as @daily and @midnight. Which midnight it means, variants, and the GitHub Actions and AWS forms.

Cron expression
0 0 * * *
See the next run times

The expression

0 0 * * *

Runs once a day at 00:00, at the very start of each day, 365 times a year.

Field Value Meaning
Minute 0 at minute 0
Hour 0 at hour 0 (midnight)
Day of month * every day
Month * every month
Day of week * every day of the week

The macros @daily and @midnight are exact synonyms. Note that the job runs at the start of the day: a report for "yesterday" scheduled at 0 0 * * * should use the previous date, not the date the job sees.

Variants

Schedule Expression
Every day at 00:30 30 0 * * *
Every day at 23:59 (end of day) 59 23 * * *
Midnight on weekdays 0 0 * * 1-5
Midnight on Sunday 0 0 * * 0
Midnight on the 1st of each month 0 0 1 * *
Every day at 9:00 0 9 * * *
Midnight and noon 0 0,12 * * *

Hour 24 doesn't exist in cron; the valid range is 0-23, and "midnight at the end of today" is 0 0 of tomorrow.

Where to write it

  • crontab (Linux, macOS): 0 0 * * * /usr/local/bin/nightly.sh or @daily /usr/local/bin/nightly.sh in crontab -e. "Midnight" is the server's time zone; CRON_TZ=Europe/Madrid at the top of the crontab changes it on cronie. Scripts in /etc/cron.daily/ usually run at a different time (6:25 on Debian, randomized via anacron on Red Hat).
  • GitHub Actions: on: schedule: - cron: '0 0 * * *' is midnight UTC, one of the most crowded moments on GitHub's schedulers, so runs are often late. Choose another minute, such as 17 0 * * *.
  • Kubernetes CronJob: schedule: "0 0 * * *" or "@daily", with timeZone: "America/New_York" for local midnight.
  • AWS EventBridge: cron(0 0 * * ? *), six fields with ? for day of week. Rules run in UTC; EventBridge Scheduler lets you set a time zone instead. rate(1 day) counts from rule creation, not midnight.

Common mistakes

  • * 0 * * * runs 60 times, every minute from 00:00 to 00:59.
  • 0 0 0 * * is invalid: day of month starts at 1.
  • Wrong midnight. A UTC server runs this at 01:00 or 02:00 in Central Europe and the evening before in the Americas. Daily totals then straddle two local days.
  • Everyone at once. Backups, log rotation and renewals all love midnight. Spread heavy jobs across the night to avoid I/O contention.

Paste any expression into the Cron Expression Parser to see it in words and its next run times.