crontool
Paste a schedule, read it in English, see the next runs.

Cron: Is Sunday 0 or 7?

In standard Unix/Vixie cron, Sunday is 0 — and 7 also works as Sunday. The day-of-week field accepts 0-7 where both 0 and 7 are Sunday. Monday is 1 through Saturday is 6.

The mapping

0 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday, and 7 = Sunday again. So 0 0 * * 0 and 0 0 * * 7 both run at midnight every Sunday.

Why 7 exists

The duplicate lets people who think of the week as Monday-to-Sunday (1-7) write Sunday as 7. Both resolve to the same day.

Names work too

Most cron implementations accept three-letter names: SUN, MON, ... SAT. 0 0 * * SUN is the clearest way to avoid the 0/7 confusion.

Quartz is different

Quartz cron (Java, Spring) uses 1-7 where 1 = Sunday and 7 = Saturday, and has a 6-or-7 field format. If you copy a Unix cron string into a Spring @Scheduled cron, the weekday numbers will be wrong. Always check which dialect your scheduler uses.

FAQ

Is Sunday 0 or 7 in cron?

In standard Unix/Vixie cron both 0 and 7 mean Sunday. 0 0 * * 0 and 0 0 * * 7 are equivalent.

What number is Monday in cron?

Monday is 1, Tuesday 2, Wednesday 3, Thursday 4, Friday 5, Saturday 6, and Sunday is 0 or 7.

Does Quartz use the same day numbers?

No. Quartz (Java/Spring) uses 1-7 where 1 is Sunday and 7 is Saturday, so weekday numbers do not match Unix cron.