Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Day-of-week: Allowed range 0 – 7. Sunday is either 0 or 7.

I found this after Googling, my question is why should both values (0,7) correspond to Sunday?

share|improve this question
I think that a logical think some country start the week the monday and some other on sunday so puting the sunday first and last resolve this misunderstanding I guess – Kiwy Dec 20 '13 at 8:55
Because sunday is such an awsome day, don't you agree? :P – Alko Dec 20 '13 at 13:13
Because Americans think Sunday is the first day of the week, but Europeans say Sunday is the last day of the week. – Pieter B Dec 20 '13 at 15:16
Don't forget about Funday. – BigHomie Dec 20 '13 at 16:02
Because by the seventh day, God completed His work which He had done, and He rested on the seventh day from all His work which He had done. – user84207 Jul 18 '14 at 16:56
up vote 93 down vote accepted

This is a matter of portability. In early Unices, some versions of cron accepted 0 as Sunday, and some accepted 7 as Sunday -- this format is an attempt to be portable with both. From man 5 crontab in vixie-cron (emphasis my own):

When specifying day of week, both day 0 and day 7 will be considered Sunday. BSD and AT&T seem to disagree about this.

share|improve this answer
There are 10 kinds of people, those who start counting with 0 and those who start with 1. – Hagen von Eitzen Dec 20 '13 at 13:17
@HagenvonEitzen I remember the joke differently: There are 10 kinds of people, those who understand binary and those who don't. -- Also: There are 2 kinds of people: (1.) those who start counting with 1, (1.) those who start with 0. – leemes Dec 20 '13 at 13:49
I have another version - there are three kinds of people in the world - those that can count and those that cant. – flurbius Dec 20 '13 at 14:59
Or: There are two types of people. Those that can extrapolate from incomplete data. – Bernhard Dec 20 '13 at 15:14
Or: There are 10 types of people in the world - those who understand Gray code, those who don't and those who expected a joke about binary. – OnoSendai Dec 20 '13 at 15:22

In addition to @ChrisDown's excellent answer, this might also be a nifty solution to a localisation issue: "According to the Hebrew calendars and traditional Christian calendars, Sunday is the first day of the week." Having it both ways, which is really easy programmatically, makes it easy to use for either group.

share|improve this answer
Kudos, for your support @l0b0 – Ruban Savvy Dec 20 '13 at 9:21
+1, good answer. I assume this is the reason why AT&T and BSD didn't agree :-) – Chris Down Dec 20 '13 at 9:31
:) hope so heh heh ;) – Ruban Savvy Dec 20 '13 at 9:34

From manual:

day of week (0 - 7) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)

share|improve this answer
How does this add new information that the OP doesn't seem to know about? – Joseph R. Dec 20 '13 at 23:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.