Skip to content
cronhelp.me
Guide · Foot-guns

Sunday written as 7

Short answer
Both 0 and 7 mean Sunday in most cron implementations, but not all of them accept 7. Using 0 is the portable choice.
WrongSunday as 7 — not universally accepted
0 0 * * 7
RightSunday as 0 — accepted everywhere
0 0 * * 0

In the day-of-week field the week is numbered 0 to 6, Sunday through Saturday. As a convenience, many cron implementations also accept 7 as an alias for Sunday, so the week can be read 1 (Monday) through 7 (Sunday) if you prefer. Both 0 0 * * 0 and 0 0 * * 7 therefore mean "every Sunday" on those systems.

The wrinkle is portability. The 7-for-Sunday alias is common but not universal: some stricter parsers, and some non-cron schedulers that borrow cron syntax, reject 7 as out of range because their day-of-week field is defined as 0–6. An expression that runs fine on your Linux box can fail to load on another platform for this one reason.

This is only an informational note — if your target system accepts 7, nothing is broken. But because 0 is accepted everywhere and 7 is not, 0 is the safer default, especially in code you might move between platforms or hand to someone else. Some tools also silently normalise 7 to 0 when they rewrite a crontab, which can produce confusing diffs if half your entries use each form.

A related gotcha: mixing the two conventions in a range. 5-7 is read by the parser as "Friday through Sunday", keeping the 7 as an endpoint so the range direction stays meaningful, and Sunday is folded to 0 only once the range is expanded. If you write day-of-week ranges, sticking to the 0–6 numbering avoids any doubt about where the week starts and ends. When in doubt, use 0 for Sunday and name the others with SUNSAT if your cron supports names.

Watch the linter flag it live — the finding below appears the moment the expression is entered:

Cron expression5-field
At 12:00 AM, only on Sunday
Lint
Infodow-sunday-7
Some cron programs do not accept 7 for Sunday and will reject this entry. Write Sunday as '0' or 'SUN', which every implementation accepts.
Learn more →
Next runs
#
1
2
3
4
5
6
7
Copy as
All lint rulesSeverity: Info