Skip to content
Webmaster Tools
Dev utilitiesCron ParserEvery Sunday at midnight

Cron every Sunday at midnight

The cron expression for every Sunday at midnight is 0 0 * * 0, which runs at 00:00 at the start of Sunday. Sunday as 0 or 7, Saturday vs Sunday night, platform forms.

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

The expression

0 0 * * 0

Runs once a week, at 00:00 on Sunday: the moment Saturday turns into Sunday.

Field Value Meaning
Minute 0 at minute 0
Hour 0 at midnight
Day of month * any day
Month * every month
Day of week 0 Sunday

Sunday has two numbers in standard cron: 0 and 7 both mean Sunday, so 0 0 * * 7 and 0 0 * * SUN are the same schedule. This is also exactly what the @weekly macro expands to.

Saturday night or Sunday night?

"Sunday at midnight" is ambiguous in everyday speech. Cron's 0 0 * * 0 is the start of Sunday, which many people would call Saturday night. If you mean the end of Sunday, the night before Monday, write one of these:

You mean Expression
Start of Sunday (Saturday night) 0 0 * * 0
Last minute of Sunday 59 23 * * 0
Start of Monday (Sunday night) 0 0 * * 1

For a weekly report that should include all of Sunday, the start of Monday is usually what you want.

Variants

Schedule Expression
Sunday at 3am (a common maintenance slot) 0 3 * * 0
Sunday at noon 0 12 * * 0
Saturday and Sunday at midnight 0 0 * * 6,0
Once a week, whichever day @weekly
Every day at midnight 0 0 * * *

Where to write it

  • crontab (Linux, macOS): 0 0 * * 0 /usr/local/bin/rotate-logs.sh in crontab -e, or @weekly /usr/local/bin/rotate-logs.sh. Both use the server's time zone.
  • GitHub Actions: on: schedule: - cron: '0 0 * * 0' is midnight UTC, which in the Americas is still Saturday evening. GitHub doesn't accept @weekly, and many workflows share the midnight slot, so a start a few minutes late is normal; 0 3 * * 0 is quieter.
  • Kubernetes CronJob: schedule: "0 0 * * 0" (or "@weekly") with timeZone: for your local midnight.
  • AWS EventBridge: cron(0 0 ? * SUN *). EventBridge numbers Sunday as 1 and has no day 0, so copying the numeric form fails.

Common mistakes

  • Using 1 for Sunday. In standard cron 1 is Monday; only AWS and Quartz start the week at 1 = Sunday.
  • Daylight saving. In many zones the clocks change early on a Sunday morning; a job at 00:00 is safe, but one at 02:00 or 03:00 local can be skipped or run twice, depending on the cron implementation.

See the next Sundays in the Cron Expression Parser.