Cron daily at midnight: the expression
0 0 * * *
Minute 0 and hour 0 fix the time at 00:00, and the three * let every day, month and weekday match: one run a day, at midnight of the server's clock. The shortcut @daily (also @midnight) is the same expression.
This page opens the crontab generator with the expression loaded: it describes it in plain words, checks every field and lists the next runs in the time zone you choose. Read by the tool: "At 00:00".
Field by field
| Field | Allowed values | Here |
|---|---|---|
| minute | 0-59 | 0 |
| hour | 0-23 | 0 |
| day of month | 1-31 | * |
| month | 1-12 | * |
| day of week | 0-7 (0 and 7 = Sunday) | * |
Minute 0, hour 0, day *, month *, weekday *.
The next runs
Counted from Mon, Jan 5, 2026, 08:07:00 (UTC), the first five runs are:
- Tue, Jan 6, 2026, 00:00:00
- Wed, Jan 7, 2026, 00:00:00
- Thu, Jan 8, 2026, 00:00:00
- Fri, Jan 9, 2026, 00:00:00
- Sat, Jan 10, 2026, 00:00:00
In a crontab
crontab -e
0 0 * * * /usr/local/bin/backup-db.sh >> /var/log/backup.log 2>&1
crontab -l # lists what is installedThe same schedule in other systems
| System | Expression |
|---|---|
| Linux cron, Kubernetes CronJob, GitHub Actions (5 fields) | 0 0 * * * |
| Quartz and Spring (6 fields, with seconds) | 0 0 0 * * ? |
| AWS EventBridge (6 fields, with year) | cron(0 0 * * ? *) |
The tool reads the three forms and produces exactly the same runs for them; the page checks that while it is built. Quartz writes it with seconds and a "?": 0 0 0 * * ?, and AWS EventBridge with six fields: 0 0 * * ? *. EventBridge and GitHub Actions schedules run in UTC; for a local midnight, convert it with the time zone converter.
What it is used for
- Database and file backups, which prefer a quiet moment.
- Closing the day: daily totals, invoices, expiring trial accounts and reports for the previous day.
- Resetting daily counters and quotas.
Common mistakes
- Forgetting the time zone: cron uses the server's time zone, often UTC. A job at 0 0 * * * on a UTC server runs at 21:00 the previous evening in São Paulo, and at 19:00 in New York in winter. Check the zone, or convert the time before writing the expression.
- Piling every nightly job at midnight: backups, reports and cleanups then compete for the same disk and CPU. Spread them over the night (0 1, 15 2, 30 3).
How to use the generator
- The expression is already in the box; edit any field, or toggle values in the field editor.
- Choose the style (Linux, with seconds, Quartz or AWS) and the time zone, and see the next 5, 10 or 20 runs.
- Copy the expression into your crontab, your workflow file or your EventBridge rule.
Frequently asked questions
What is the cron expression for every day at midnight?
0 0 * * *, or @daily. For another time change the first two fields: 30 6 * * * is every day at 06:30.
Is midnight 0 or 24 in cron?
- The hour field goes from 0 to 23, so 24 is invalid and the tool reports it.
What happens at a daylight saving change?
At midnight usually nothing, but a job scheduled between 02:00 and 03:00 may be skipped or run twice on the days the clocks change in zones that have it. The tool marks such runs in its list.