curly{bits}

curlybits / Cron Generator / Cron Every Day at Midnight

Cron Job Every Day at Midnight

To run a cron job every day at midnight, use 0 0 * * *. It runs once a day at 00:00, in the server's time zone. It's the same as @daily and @midnight.

Common schedules:

Next 10 runs

How to use the Cron Job Every Day at Midnight

  1. Copy 0 0 * * * and put your command after it in your crontab (open it with crontab -e).
  2. Check the next run times below, in UTC or your server's time zone.
  3. Need something slightly different? Edit any field and the description updates as you type.

The crontab line

0 0 * * * /path/to/your-script.sh >> /var/log/your-script.log 2>&1

The five fields are minute, hour, day of month, month and day of week. Redirecting output to a log file (>> … 2>&1) keeps errors you'd otherwise never see.

Good for

  • Nightly backups and database dumps
  • Daily reports and invoices
  • Deleting expired sessions and old files

Variations

0 2 * * *Every day at 2:00 AM (quieter than midnight, when many jobs run)
30 23 * * *Every day at 11:30 PM
0 0 * * 1-5Midnight on weekdays only
@dailyShortcut for 0 0 * * *

Same schedule elsewhere

GitHub Actionson: schedule: - cron: '0 0 * * *' (always UTC)
Kubernetesspec.schedule: "0 0 * * *" in a CronJob
Vercel"crons": [{"path": "/api/job", "schedule": "0 0 * * *"}] in vercel.json

Frequently asked questions

Is midnight UTC the same as my midnight?

Only if you're in UTC. Midnight UTC is 7 AM in Bangkok and 8 PM (or 7 PM in summer) the day before in New York. Pick your zone in the next-runs table to check.

What time zone does it use?

The time zone of the machine or service running cron, which is usually UTC on servers and cloud schedulers. GitHub Actions always uses UTC.