Cron expression for every day at midnight
0 0 * * * runs once a day at 00:00. Change the first two fields to pick another time: minute first, then hour.
This tool runs in your browser. We never send what you type or paste to a server.
The expression
0 0 * * * /path/to/commandThe expression has five fields, read left to right:
| Field | Value | Meaning here |
|---|---|---|
| Minute | 0 | at minute 0 |
| Hour | 0 | at hour 0, which is midnight |
| Day of month | * | every day of the month |
| Month | * | every month |
| Day of week | * | every day of the week |
When it runs
Starting from Wed 2027-01-06 10:07 UTC, the next runs are:
Thu 2027-01-07 00:00
Fri 2027-01-08 00:00
Sat 2027-01-09 00:00
Sun 2027-01-10 00:00
Mon 2027-01-11 00:00
Tue 2027-01-12 00:00Cron uses the time zone of the machine or service that runs it. The explainer at the top of this page shows the next runs in your own time zone.
Other times of day
0 0 * * * 00:00 (midnight)
30 2 * * * 02:30
0 6 * * * 06:00
0 12 * * * 12:00 (noon)
45 23 * * * 23:45
@daily the same as 0 0 * * *; @midnight is another name for itThe hour is on the 24-hour clock. There is no AM or PM in cron, so 6pm is 18.
Whose midnight?
The server's. On a machine set to UTC, 0 0 * * * fires at 19:00 or 20:00 the previous evening in New York, and at 09:00 in Tokyo. Check with date or timedatectl. cronie, the cron used by Red Hat-family systems, accepts a CRON_TZ=Europe/Berlin line in the crontab. Kubernetes has spec.timeZone. GitHub Actions is always UTC.
Midnight is crowded, and 2am is fragile
- Midnight is when everybody's daily jobs start. If your job calls a shared database or an external API, a few minutes' offset such as
7 0 * * *avoids the rush. - Where clocks change for daylight saving time, local times between 01:00 and 03:00 are skipped once a year and repeated once a year. Depending on the cron implementation, a job set for 02:30 can be skipped or run twice on those nights. Midnight itself is safe in most zones.
- A
rate(1 day)schedule on AWS EventBridge is not the same thing: it runs every 24 hours counted from when the rule was created, not at midnight.
Quartz adds a seconds field at the front, AWS adds a year at the end, and both need ? in one of the two day fields. See how the syntaxes differ.
The same schedule in other schedulers
| Scheduler | Expression |
|---|---|
| Unix cron, crontab | 0 0 * * * or @daily |
| Kubernetes CronJob | schedule: "0 0 * * *" |
| GitHub Actions | - cron: '0 0 * * *' |
| Quartz (Java, Spring) | 0 0 0 * * ? |
| AWS EventBridge | cron(0 0 * * ? *) |
Questions
What is the cron expression for midnight every day?
0 0 * * *: minute 0, hour 0, every day. @daily and @midnight mean the same in most cron implementations.
How do I run a cron job every day at a specific time?
Put the minute in the first field and the hour (0 to 23) in the second: 30 14 * * * runs every day at 14:30.
Is midnight 0 or 24 in cron?
0. The hour field runs from 0 to 23, and 24 is rejected.