Determination of the day of the week

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

The determination of the day of the week for any date may be performed with a variety of algorithms. In addition, perpetual calendars require no calculation by the user, and are essentially lookup tables. A typical application is to calculate the day of the week on which someone was born or a specific event occurred.

Concepts[edit]

In numerical calculation, the days of the week are represented as weekday numbers. If Monday is the first day of the week, the days may be coded 1 to 7, for Monday through Sunday, as is practiced in ISO 8601. The day designated with 7 may also be counted as 0, by applying the arithmetic modulo 7, which calculates the remainder of a number after division by 7. Thus, the number 7 is treated as 0, 8 as 1, 9 as 2, 18 as 4 and so on. If Sunday is counted as day 1, then 7 days later (i.e. day 8) is also a Sunday, and day 18 is the same as day 4, which is a Wednesday since this falls three days after Sunday.[1]

Standard Monday Tuesday Wednesday Thursday Friday Saturday Sunday Usage examples
ISO 8601 1 2 3 4 5 6 7 %_ISODOWI%, %@ISODOWI[]% (4DOS);[2] DAYOFWEEK() (HP Prime)[3]
0 1 2 3 4 5 6
2 3 4 5 6 7 1 %NDAY OF WEEK% (NetWare, DR-DOS[4]); %_DOWI%, %@DOWI[]% (4DOS)[2]
1 2 3 4 5 6 0 HP financial calculators

The basic approach of nearly all of the methods to calculate the day of the week begins by starting from an 'anchor date': a known pair (such as January 1, 1800 as a Wednesday), determining the number of days between the known day and the day that you are trying to determine, and using arithmetic modulo 7 to find a new numerical day of the week.

One standard approach is to look up (or calculate, using a known rule) the value of the first day of the week of a given century, look up (or calculate, using a method of congruence) an adjustment for the month, calculate the number of leap years since the start of the century, and then add these together along with the number of years since the start of the century, and the day number of the month. Eventually, one ends up with a day-count to which one applies modulo 7 to determine the day of the week of the date.[5]

Some methods do all the additions first and then cast out sevens, whereas others cast them out at each step, as in Lewis Carroll's method. Either way is quite viable: the former is easier for calculators and computer programs, the latter for mental calculation (it is quite possible to do all the calculations in one's head with a little practice). None of the methods given here perform range checks, so unreasonable dates will produce erroneous results.

Corresponding days[edit]

Every seventh day in a month has the same name as the previous:

Day of
the month
d
00 07 14 21 28 0
01 08 15 22 29 1
02 09 16 23 30 2
03 10 17 24 31 3
04 11 18 25 4
05 12 19 26 5
06 13 20 27 6

Corresponding months[edit]

"Corresponding months" are those months within the calendar year that start on the same day of the week. For example, September and December correspond, because September 1 falls on the same day as December 1 (as there are precisely thirteen 7-day weeks between the two dates). Months can only correspond if the number of days between their first days is divisible by 7, or in other words, if their first days are a whole number of weeks apart. For example, February of a common year corresponds to March because February has 28 days, a number divisible by 7, 28 days being exactly four weeks. In a leap year, January and February correspond to different months than in a common year, since adding February 29 means each subsequent month starts a day later.

January corresponds to October in common years and April and July in leap years. February corresponds to March and November in common years and August in leap years. March always corresponds to November, April always corresponds to July, and September always corresponds to December. August does not correspond to any other month in a common year. October doesn't correspond to any other month in a leap year. May and June never correspond to any other month.

In the months table below, corresponding months have the same number, a fact which follows directly from the definition.

Common years Leap years m
Jan Oct Oct 0
May May 1
Aug Feb Aug 2
Feb Mar Nov Mar Nov 3
Jun Jun 4
Sept Dec Sept Dec 5
Apr July Jan Apr July 6

Corresponding years[edit]

There are seven possible days that a year can start on, and leap years will alter the day of the week after February 29. This means that there are 14 configurations that a year can have. All the configurations can be referenced by a dominical letter, but as February 29 has no letter allocated to it a leap year has two dominical letters, one for January and February and the other (one step back in the alphabetical sequence) for March to December.

For example, 2019 was a common year starting on Tuesday, indicating that the year as a whole corresponded to the 2013 calendar year. On the other hand, 2020 is a leap year starting on Wednesday which, on the whole, corresponds to the 1992 calendar year; specifically, its first 2 months, except for February 29, corresponds to those of the 2014 calendar year, while, due to the 2020 leap day, its subsequent 10 months correspond to the 2015 calendar year.

Moreover:

  • the year 1980 was a leap year starting on Tuesday: its first 2 months, except 29 February, corresponded to those of the 1974 calendar year and its subsequent 10 months corresponded to the 1975 calendar year. The year as a whole corresponded to the 1952 calendar year. 29 February was a Friday. The next leap year starting on a Tuesday after this year was 2008.
  • the year 1981 was a common year starting on Thursday: its first 2 months corresponded, apart from February 29, to those of the 1976 calendar year and its subsequent 10 months corresponded to the 1970 calendar year. Of course, since neither 1970 nor 1981 was a leap year these two years correspond in their entirety. The next common year starting on Thursday after this year was 1987.
  • the year 1982 was a common year starting on Friday: its first 2 months corresponded, apart from February 29, to those of the 1971 calendar year and its subsequent 10 months corresponded to the 1976 calendar year. Of course, since neither 1971 nor 1982 was a leap year these two years correspond in their entirety. The next common year starting on Friday after this year was 1993. Common years starting on Friday are one of three types of common years an end-of-century year can begin on, and occurs in end-of-century years which yield a remainder of 100 when divided by 400. The last such end-of-century year was 1700, and the next one will be 2100.
  • the year 1983 was a common year starting on Saturday: the year as a hole corresponded to the 1977 calendar year. The next common year starting on a Saturday after this year was be 1994.
  • the year 1984 was a leap year starting on Sunday: its first 2 months, except 29 February, corresponded to those of the 1978 calendar year and its subsequent 10 months corresponded to the 1979 calendar year. The year as a whole corresponded to the 1956 calendar year. 29 February was a Wednesday. The next leap year starting on a Sunday after this year was 2012.
  • the year 1985 was a common year starting on Tuesday: its first 2 months corresponded to those of the 1980 calendar year and its subsequent 10 months corresponded to the 1974 calendar year. Of course, since neither 1974 nor 1985 was a leap year these two years correspond in their entirety. The next common year starting on Tuesday after this year was 1991.
  • the year 1986 was a common year starting on Wednesday: its first 2 months corresponded, apart from February 29, to those of the 1975 calendar year and its subsequent 10 months corresponded to the 1980 calendar year. Of course, since neither 1975 nor 1986 was a leap year these two years correspond in their entirety. The next common year starting on Wednesday after this year was 1997. Common years starting on Wednesday are one of three types of common years an end-of-century year can begin on, and occurs in end-of-century years which yield a remainder of 200 when divided by 400. The last such end-of-century year was 1800 and the next one will be 2200.
  • the year 1987 was a common year starting on Thursday: the year as a whole corresponded to the 1981 calendar year. The next common year starting on Thursday after this year was 1998.
  • the year 1988 was a leap year starting on Friday: its first 2 months, except 29 February, corresponded to those of the 1982 calendar year and its subsequent 10 months corresponded to the 1983 calendar year. The year as a whole corresponded to the 1960 calendar year. 29 February was a Monday. The next leap year starting on a Friday after this year was 2016.
  • the year 1989 was a common year starting on Sunday: its first 2 months corresponded, apart from February 29, to those of the 1984 calendar year and its subsequent 10 months corresponded to the 1978 calendar year. Of course, since neither 1978 nor 1989 was a leap year these two years correspond in their entirety. The next common year starting on Sunday after this year was 1995.
  • the year 1990 was a common year starting on Monday: its first 2 months corresponded to those of the 1979 calendar year and its subsequent 10 months corresponded to the 1984 calendar year. Of course, since neither 1979 nor 1990 was a leap year these two years correspond in their entirety. The next common year starting on Monday after this year was 2001. Common years starting on Monday are one of three types of common years an end-of-century year can begin on, and occurs in end-of-century years which yield a remainder of 300 when divided by 400. The last such end-of-century year was 1900 and the next one will be 2300.
  • the year 1991 was a common year starting on Tuesday: the year as a whole corresponded to the 1985 calendar year. The next common year starting on Tuesday after this year was 2002.
  • the year 1992 was a leap year starting on Wednesday: its first 2 months, except 29 February, corresponded to those of the 1986 calendar year and its subsequent 10 months corresponded to the 1987 calendar year. The year as a whole corresponded to the 1964 calendar year. 29 February was a Saturday. The next leap year starting on Wednesday after this year was 2020.
  • the year 1993 was a common year starting on Friday: its first 2 months corresponded, apart from February 29, to those of the 1988 calendar year and its subsequent 10 months corresponded to the 1982 calendar year. Of course, since neither 1982 nor 1993 was a leap year these two years correspond in their entirety. The next leap year starting on Friday after this year was 1999.
  • the year 1994 was a common year starting on Saturday: its first 2 months corresponded to those of the 1983 calendar year and its subsequent 10 months corresponded to the 1988 calendar year. Of course, since neither 1983 nor 1994 was a leap year these two years correspond in their entirety. The next common year starting on Saturday after this year was 2005.
  • the year 1995 was a common year starting on Sunday: the year as a whole corresponded to the 1989 calendar year. The next common year starting on Sunday after this year was 2006.
  • the year 1996 was a leap year starting on Monday: its first 2 months, except 29 February, corresponded to those of the 1990 calendar year and its subsequent 10 months corresponded to the 1991 calendar year. The year as a whole corresponded to the 1968 calendar year. 29 February was a Thursday. The next leap year starting on Monday will be 2024.
  • the year 1997 was a common year starting on Wednesday: its first 2 months corresponded, apart from February 29, to those of the 1992 calendar year and its subsequent 10 months corresponded to the 1986 calendar year. Of course, since neither 1986 nor 1997 was a leap year these two years correspond in their entirety. The next common year starting on Wednesday after this year was 2003.
  • the year 1998 was a common year starting on Thursday: its first 2 months corresponded, apart from February 29, to those of the 1987 calendar year and its subsequent 10 months corresponded to the 1992 calendar year. Of course, since neither 1992 nor 1998 was a leap year these two years correspond in their entirety. The next common year starting on Thursday after this year was 2009.
  • the year 1999 was a common year starting on Friday: the year as a whole corresponded to the 1993 calendar year. The next common year starting on Friday after this year was 2010.
  • the year 2000 was a leap year starting on Saturday: its first 2 months, except 29 February, corresponded to those of the 1994 calendar year and its subsequent 10 months corresponded to the 1995 calendar year. The year as a whole corresponded to the 1972 calendar year. 29 February was a Tuesday. All end-of-century leap years begin on a Saturday, and the next such leap year will be 2400.
  • the year 2001 was a common year starting on Monday: its first 2 months corresponded, apart from February 29, to those of the 1996 calendar year and its subsequent 10 months corresponded to the 1990 calendar year. Of course, since neither 1990 nor 2001 was a leap year these two years correspond in their entirety. The next common year starting on Monday after this year was 2007.
  • the year 2002 was a common year starting on Tuesday: its first 2 months corresponded to those of the 1991 calendar year and its subsequent 10 months corresponded to the 1996 calendar year. Of course, since neither 1991 nor 2002 was a leap year these two years correspond in their entirety. The next common year starting on Tuesday after this year was 2013.
  • the year 2003 was a common year starting on Wednesday: the year as a whole corresponded to the 1997 calendar year. The next common year starting on Wednesday after this year was 2014.
  • the year 2004 was a leap year starting on Thursday: its first 2 months, except 29 February, corresponded to those of the 1998 calendar year and its subsequent 10 months corresponded to the 1999 calendar year. The year as a whole corresponded to the 1976 calendar year. 29 February was a Sunday. The next leap year starting on a Thursday will be 2032.
  • the year 2005 was a common year starting on Saturday: its first 2 months corresponded, apart from February 29, to those of the 2000 calendar year and its subsequent 10 months corresponded to the 1994 calendar year. Of course, since neither 1994 nor 2005 was a leap year these two years correspond in their entirety. The next common year starting on Saturday after this year was 2011.
  • the year 2006 was a common year starting on Sunday: its first 2 months corresponded to those of the 1995 calendar year and its subsequent 10 months corresponded to the 2000 calendar year. Of course, since neither 1995 nor 2006 was a leap year these two years correspond in their entirety. The next common year starting on Sunday after this year was 2017.
  • the year 2007 was a common year starting on Monday: the year as a whole corresponded to the 2001 calendar year. The next common year starting on Monday after this year was 2018.
  • the year 2008 was a leap year starting on Tuesday: its first 2 months, except 29 February, corresponded to those of the 2002 calendar year and its subsequent 10 months corresponded to the 2003 calendar year. The year as a whole corresponded to the 1980 calendar year. 29 February was a Friday. The next leap year starting on a Tuesday will be 2036.
  • the year 2009 was a common year starting on Thursday: its first 2 months corresponded, apart from February 29, to those of the 2004 calendar year and its subsequent 10 months corresponded to the 1998 calendar year. Of course, since neither 1998 nor 2009 was a leap year these two years correspond in their entirety. The next common year starting on Thursday after this year was 2015.
  • the year 2010 was a common year starting on Friday: its first 2 months corresponded to those of the 1999 calendar year and its subsequent 10 months corresponded to the 2004 calendar year. Of course, since neither 1999 nor 2010 was a leap year these two years correspond in their entirety. The next common year starting on a Friday will be 2021.
  • the year 2011 was a common year starting on Saturday: the year as a whole corresponded to the 2005 calendar year. The next common year starting on Saturday will be 2022.
  • the year 2012 was a leap year starting on Sunday: its first 2 months, except 29 February, corresponded to those of the 2006 calendar year and its subsequent 10 months corresponded to the 2007 calendar year. The year as a whole corresponded to the 1984 calendar year. 29 February was a Wednesday. The next leap year that starts on a Sunday will be 2040.
  • the year 2013 was a common year starting on Tuesday: its first 2 months corresponded, apart from February 29, to those of the 2008 calendar year and its subsequent 10 months corresponded to the 2002 calendar year. Of course, since neither 2002 nor 2013 was a leap year these two years correspond in their entirety. After this year, the next common year starting on Tuesday was 2019.
  • the year 2014 was a common year starting on Wednesday: its first 2 months corresponded to those of the 2003 calendar year and its subsequent 10 months corresponded to the 2008 calendar year. Of course, since neither 2003 nor 2014 was a leap year these two years correspond in their entirety. The next common year starting on Wednesday will be 2025.
  • the year 2015 was a common year starting on Thursday: the year as a whole corresponded to the 2009 calendar year. The next common year starting on Thursday will be 2026.
  • the year 2016 was a leap year starting on Friday: its first 2 months, except 29 February, corresponded to those of the 2010 calendar year and its subsequent 10 months corresponded to the 2011 calendar year. The year as a whole corresponded to the 1988 calendar year. 29 February was a Monday. The next leap year that starts on a Friday will be 2044.
  • the year 2017 was a common year starting on Sunday: its first 2 months corresponded, apart from February 29, to those of the 2012 calendar year and its subsequent 10 months corresponded to the 2006 calendar year. Of course, since neither 2006 nor 2017 was a leap year these two years correspond in their entirety. The next leap year that starts on a Sunday will be 2023.
  • the year 2018 was a common year starting on Monday: its first 2 months corresponded to those of the 2007 calendar year and its subsequent 10 months corresponded to the 2012 calendar year. Of course, since neither 2007 nor 2018 was a leap year these two years correspond in their entirety. The next leap year that starts on a Monday will be 2029.
  • the year 2019 was a common year starting on Tuesday: the year as a whole corresponded to the 2013 calendar year. The next common year that starts on a Tuesday will be 2030.
  • the year 2020 is a leap year starting on Wednesday: its first 2 months, except 29 February, correspond to those of the 2014 calendar year and its subsequent 10 months will correspond to the 2015 calendar year. The year as a whole corresponds to the 1992 calendar year. 29 February was a Saturday. After this year, the next leap year that starts on a Wednesday will be 2048.
  • the year 2021 will be a common year starting on Friday: its first 2 months will correspond, apart from February 29, to those of the 2016 calendar year and its subsequent 10 months will correspond to the 2010 calendar year. Of course, since neither 2010 nor 2021 is a leap year these two years correspond in their entirety. After this year, the next common year that starts on a Friday will be 2027.
  • the year 2022 will be a common year starting on Saturday: its first 2 months will correspond to those of the 2011 calendar year and its subsequent 10 months will correspond to the 2016 calendar year. Of course, since neither 2011 nor 2022 is a leap year these two years correspond in their entirety. After this year, the next common year that starts on a Saturday will be 2033.
  • the year 2023 will be a common year starting on Sunday: the year as a whole will correspond to the 2017 calendar year. After this year, the next leap year that starts on a Sunday will be 2034.
  • the year 2024 will be a leap year starting on Monday: its first 2 months, except 29 February, will correspond to those of the 2018 calendar year and its subsequent 10 months will correspond to the 2019 calendar year. The year as a whole will correspond to the 1996 calendar year. 29 February will be a Thursday. After this year, the next leap year that starts on a Monday will be 2052.
  • the year 2025 will be a common year starting on Wednesday: its first two months will correspond to those in the 2020 calendar year and its subsequent 10 months will correspond to the 2014 calendar year. Of course, since neither 2014 nor 2025 is a leap year these two years correspond in their entirety. After this year, the next common year that starts on a Wednesday will be 2031.
  • the year 2026 will be a common year starting on Thursday: its first two months will correspond to those in the 2015 calendar year and its subsequent 10 months will correspond to those in the 2020 calendar year. Of course, since neither 2015 nor 2026 is a leap year these two years correspond in their entirety. After this year, the next common year that starts on Thursday will be 2037.
  • the year 2027 will be a common year starting on Friday: the year as a whole will correspond to the 2021 calendar year. After this year, the next common year that starts on Friday will be 2038.
  • the year 2028 will be a leap year starting on Saturday: its first two months, except February 29, will correspond to those of the 2022 calendar year and its subsequent 10 months will correspond to those in the 2023 calendar year. The year as a whole will correspond to the 2000 calendar year. 29 February will be a Tuesday. After this year, the next leap year that begins on a Saturday will be 2056.
  • the year 2029 will be common year starting on Monday: its first 2 months will correspond, apart from February 29, to those of the 2024 calendar year and its subsequent 10 months corresponded to the 2018 calendar year. Of course, since neither 2018 nor 2029 is a leap year these two years correspond in their entirety. The next common year starting on Monday after this year is 2035.
  • the year 2030 will be common year starting on Tuesday: its first 2 months will correspond to those of the 2019 calendar year and its subsequent 10 months corresponded to the 2024 calendar year. Of course, since neither 2019 nor 2030 is a leap year these two years correspond in their entirety. The next common year starting on Tuesday after this year is 2041.
  • the year 2031 will be common year starting on Wednesday: the year as a whole will correspond to the 2025 calendar year. The next common year starting on Wednesday after this year is 2042.
  • the year 2032 will be leap year starting on Thursday: its first 2 months, except 29 February, will correspond to those of the 2026 calendar year and its subsequent 10 months will correspond to the 2027 calendar year. The year as a whole will correspond to the 2004 calendar year. 29 February will be a Sunday. After this year, The next leap year starting on a Thursday will be 2060.
  • the year 2033 will be common year starting on Saturday: its first 2 months will correspond, apart from February 29, to those of the 2028 calendar year and its subsequent 10 months will correspond to the 2022 calendar year. Of course, since neither 2022 nor 2033 is a leap year these two years correspond in their entirety. The next common year starting on Saturday after this year will be 2039.
  • the year 2034 will be a common year starting on Sunday: its first 2 months will correspond to those of the 2023 calendar year and its subsequent 10 months will correspond to the 2028 calendar year. Of course, since neither 2023 nor 2034 is a leap year these two years correspond in their entirety. The next common year starting on Sunday after this year will be 2045.
  • the year 2035 will be common year starting on Monday: the year as a whole will correspond to the 2029 calendar year. The next common year starting on Monday after this year will be 2046.
  • the year 2036 will be leap year starting on Tuesday: its first 2 months, except 29 February, will to those of the 2030 calendar year and its subsequent 10 months will correspond to the 2031 calendar year. The year as a whole will correspond to the 2008 calendar year. 29 February was a Friday. After this year, the next leap year starting on a Tuesday will be 2064.
  • the year 2037 will be common year starting on Thursday: its first 2 months will correspond, apart from February 29, to those of the 2032 calendar year and its subsequent 10 months will correspond to the 2026 calendar year. Of course, since neither 2026 nor 2037 was a leap year these two years correspond in their entirety. The next common year starting on Thursday after this year will be 2043.
  • the year 2038 will be common year starting on Friday: its first 2 months will correspond to those of the 2027 calendar year and its subsequent 10 months will correspond to the 2032 calendar year. Of course, since neither 2027 nor 2038 was a leap year these two years correspond in their entirety. The next common year starting on a Friday after this year will be 2066.
  • the year 2039 will be common year starting on Saturday: the year as a whole will correspond to the 2033 calendar year. The next common year starting on Saturday after this year will be 2050.
  • the year 2040 will be leap year starting on Sunday: its first 2 months, except 29 February, will correspond to those of the 2034 calendar year and its subsequent 10 months will correspond to the 2035 calendar year. The year as a whole will correspond to the 2012 calendar year. 29 February will be a Wednesday. The next leap year that starts on a Sunday after this year will be 2068.
  • the year 2041 will be common year starting on Tuesday: its first 2 months will correspond, apart from February 29, to those of the 2036 calendar year and its subsequent 10 months will correspond to the 2030 calendar year. Of course, since neither 2030 nor 2041 was a leap year these two years correspond in their entirety. After this year, the next common year starting on Tuesday will be 2047.
  • the year 2042 will be common year starting on Wednesday: its first 2 months will correspond to those of the 2031 calendar year and its subsequent 10 months will correspond to the 2036 calendar year. Of course, since neither 2031 nor 2042 is a leap year these two years correspond in their entirety. The next common year starting on Wednesday after this year will be 2053.
  • the year 2043 will be common year starting on Thursday: the year as a whole will correspond to the 2037 calendar year. The next common year starting on Thursday after this year will be 2054.
  • the year 2044 will be a leap year starting on Friday: its first 2 months, except 29 February, will correspond to those of the 2038 calendar year and its subsequent 10 months will correspond to the 2039 calendar year. The year as a whole will correspond to the 2016 calendar year. 29 February was a Monday. The next leap year that starts on a Friday after this year will be 2072.
  • the year 2045 will be common year starting on Sunday: its first 2 months will correspond, apart from February 29, to those of the 2040 calendar year and its subsequent 10 months will correspond to the 2034 calendar year. Of course, since neither 2034 nor 2040 was a leap year these two years correspond in their entirety. The next common year that starts on a Sunday after this year will be 2051.
  • the year 2046 will be a common year starting on Monday: its first 2 months will correspond to those of the 2035 calendar year and its subsequent 10 months will correspond to the 2040 calendar year. Of course, since neither 2035 nor 2046 was a leap year these two years correspond in their entirety. The next leap year that starts on a Monday after this year will be 2057.
  • the year 2047 will be a common year starting on Tuesday: the year as a whole corresponded to the 2041 calendar year. The next common year that starts on a Tuesday after this year will be 2058.
  • the year 2048 will be a leap year starting on Wednesday: its first 2 months, except 29 February, will correspond to those of the 2042 calendar year and its subsequent 10 months will correspond to the 2043 calendar year. The year as a whole will corresponds to the 2020 calendar year. 29 February will be a Saturday. After this year, the next leap year that starts on a Wednesday will be 2076.
  • the year 2049 will be a common year starting on Friday: its first 2 months will correspond, apart from February 29, to those of the 2044 calendar year and its subsequent 10 months will correspond to the 2038 calendar year. Of course, since neither 2038 nor 2049 is a leap year these two years correspond in their entirety. After this year, the next common year that starts on a Friday will be 2055.
  • the year 2050 will be a common year starting on Saturday: its first 2 months will correspond to those of the 2039 calendar year and its subsequent 10 months will correspond to the 2044 calendar year. Of course, since neither 2039 nor 2050 is a leap year these two years correspond in their entirety. After this year, the next common year that starts on a Saturday will be 2061.
  • the year 2051 will be a common year starting on Sunday: the year as a whole will correspond to the 2045 calendar year. After this year, the next leap year that starts on a Sunday will be 2062.
  • the year 2052 will be a leap year starting on Monday: its first 2 months, except 29 February, will correspond to those of the 2046 calendar year and its subsequent 10 months will correspond to the 2047 calendar year. The year as a whole will correspond to the 2024 calendar year. 29 February will be a Thursday. After this year, the next leap year that starts on a Monday will be 2080.
  • the year 2053 will be a common year starting on Wednesday: its first two months will correspond to those in the 2048 calendar year and its subsequent 10 months will correspond to the 2042 calendar year. Of course, since neither 2042 nor 2053 is a leap year these two years correspond in their entirety. After this year, the next common year that starts on a Wednesday will be 2059.
  • the year 2054 will be a common year starting on Thursday: its first two months will correspond to those in the 2043 calendar year and its subsequent 10 months will correspond to those in the 2048 calendar year. Of course, since neither 2043 nor 2054 is a leap year these two years correspond in their entirety. After this year, the next common year that starts on Thursday will be 2065.
  • the year 2055 will be a common year starting on Friday: the year as a whole will correspond to the 2049 calendar year. After this year, the next common year that starts on Friday will be 2066.
  • the year 2056 will be a leap year starting on Saturday: its first two months, except February 29, will correspond to those of the 2050 calendar year and its subsequent 10 months will correspond to those in the 2051 calendar year. The year as a whole will correspond to the 2028 calendar year. 29 February will be a Tuesday. After this year, the next leap year that begins on a Saturday will be 2084.
  • the year 2057 will be common year starting on Monday: its first 2 months will correspond, apart from February 29, to those of the 2052 calendar year and its subsequent 10 months will correspond to the 2046 calendar year. Of course, since neither 2046 nor 2057 is a leap year these two years correspond in their entirety. The next common year starting on Monday after this year is 2063.
  • the year 2058 will be common year starting on Tuesday: its first 2 months will correspond to those of the 2047 calendar year and its subsequent 10 months will correspond to the 2052 calendar year. Of course, since neither 2047 nor 2058 is a leap year these two years correspond in their entirety. The next common year starting on Tuesday after this year is 2069.
  • the year 2059 will be common year starting on Wednesday: the year as a whole will correspond to the 2053 calendar year. The next common year starting on Wednesday after this year is 2070.
  • the year 2060 will be leap year starting on Thursday: its first 2 months, except 29 February, will correspond to those of the 2054 calendar year and its subsequent 10 months will correspond to the 2055 calendar year. The year as a whole will correspond to the 2032 calendar year. 29 February will be a Sunday. After this year, The next leap year starting on a Thursday will be 2088.
  • the year 2061 will be common year starting on Saturday: its first 2 months will correspond, apart from February 29, to those of the 2056 calendar year and its subsequent 10 months will correspond to the 2050 calendar year. Of course, since neither 2050 nor 2061 is a leap year these two years correspond in their entirety. The next common year starting on Saturday after this year will be 2067.
  • the year 2062 will be a common year starting on Sunday: its first 2 months will correspond to those of the 2051 calendar year and its subsequent 10 months will correspond to the 2056 calendar year. Of course, since neither 2051 nor 2062 is a leap year these two years correspond in their entirety. The next common year starting on Sunday after this year will be 2073.
  • the year 2063 will be common year starting on Monday: the year as a whole will correspond to the 2057 calendar year. The next common year starting on Monday after this year will be 2074.
  • the year 2064 will be leap year starting on Tuesday: its first 2 months, except 29 February, will to those of the 2058 calendar year and its subsequent 10 months will correspond to the 2059 calendar year. The year as a whole will correspond to the 2036 calendar year. 29 February was a Friday. After this year, the next leap year starting on a Tuesday will be 2092.
  • the year 2065 will be common year starting on Thursday: its first 2 months will correspond, apart from February 29, to those of the 2060 calendar year and its subsequent 10 months will correspond to the 2054 calendar year. Of course, since neither 2054 nor 2065 was a leap year these two years correspond in their entirety. The next common year starting on Thursday after this year will be 2071.
  • the year 2066 will be common year starting on Friday: its first 2 months will correspond to those of the 2055 calendar year and its subsequent 10 months will correspond to the 2060 calendar year. Of course, since neither 2055 nor 2066 was a leap year these two years correspond in their entirety. The next common year starting on a Friday after this year will be 2077.
  • the year 2067 will be common year starting on Saturday: the year as a whole will correspond to the 2061 calendar year. The next common year starting on Saturday after this year will be 2078.
  • the year 2068 will be leap year starting on Sunday: its first 2 months, except 29 February, will correspond to those of the 2062 calendar year and its subsequent 10 months will correspond to the 2063 calendar year. The year as a whole will correspond to the 2040 calendar year. 29 February will be a Wednesday. The next leap year that starts on a Sunday after this year will be 2096.
  • the year 2069 will be common year starting on Tuesday: its first 2 months will correspond, apart from February 29, to those of the 2064 calendar year and its subsequent 10 months will correspond to the 2058 calendar year. Of course, since neither 2058 nor 2069 was a leap year these two years correspond in their entirety. After this year, the next common year starting on Tuesday will be 2075.
  • the year 2070 will be common year starting on Wednesday: its first 2 months will correspond to those of the 2059 calendar year and its subsequent 10 months will correspond to the 2064 calendar year. Of course, since neither 2059 nor 2070 is a leap year these two years correspond in their entirety. Th e next common year starting on Wednesday after this year will be 2081.
  • the year 2071 will be common year starting on Thursday: the year as a whole will correspond to the 2065 calendar year. The next common year starting on Thursday after this year will be 2082.
  • the year 2072 will be a leap year starting on Friday: its first 2 months, except 29 February, will correspond to those of the 2038 calendar year and its subsequent 10 months will correspond to the 2039 calendar year. The year as a whole will correspond to the 2044 calendar year. 29 February was a Monday. The next leap year that starts on a Friday after this year will be 2112.
  • the year 2073 will be common year starting on Sunday: its first 2 months will correspond, apart from February 29, to those of the 2068 calendar year and its subsequent 10 months will correspond to the 2062 calendar year. Of course, since neither 2062 nor 2073 was a leap year these two years correspond in their entirety. The next common year that starts on a Sunday after this year will be 2079.
  • the year 2074 will be a common year starting on Monday: its first 2 months will correspond to those of the 2063 calendar year and its subsequent 10 months will correspond to the 2068 calendar year. Of course, since neither 2063 nor 2074 was a leap year these two years correspond in their entirety. The next leap year that starts on a Monday after this year will be 2085.
  • the year 2075 will be a common year starting on Tuesday: the year as a whole will correspond to the 2069 calendar year. The next common year that starts on a Tuesday after this year will be 2086.
  • the year 2076 will be a leap year starting on Wednesday: its first 2 months, except 29 February, will correspond to those of the 2070 calendar year and its subsequent 10 months will correspond to the 2071 calendar year. The year as a whole will correspond to the 2048 calendar year. 29 February will be a Saturday. After this year, the next leap year that starts on a Wednesday will be 2116.
  • the year 2077 will be a common year starting on Friday: its first 2 months will correspond, apart from February 29, to those of the 2072 calendar year and its subsequent 10 months will correspond to the 2066 calendar year. Of course, since neither 2066 nor 2077 is a leap year these two years correspond in their entirety. After this year, the next common year that starts on a Friday will be 2083.
  • the year 2078 will be a common year starting on Saturday: its first 2 months will correspond to those of the 2067 calendar year and its subsequent 10 months will correspond to the 2072 calendar year. Of course, since neither 2067 nor 2078 is a leap year these two years correspond in their entirety. After this year, the next common year that starts on a Saturday will be 2089.
  • the year 2079 will be a common year starting on Sunday: the year as a whole will correspond to the 2073 calendar year. After this year, the next leap year that starts on a Sunday will be 2090.
  • the year 2080 will be a leap year starting on Monday: its first 2 months, except 29 February, will correspond to those of the 2046 calendar year and its subsequent 10 months will correspond to the 2075 calendar year. The year as a whole will correspond to the 2052 calendar year. 29 February will be a Thursday. After this year, the next leap year that starts on a Monday will be 2120.
  • the year 2081 will be a common year starting on Wednesday: its first two months will correspond to those in the 2076 calendar year and its subsequent 10 months will correspond to the 2070 calendar year. Of course, since neither 2070 nor 2081 is a leap year these two years correspond in their entirety. After this year, the next common year that starts on a Wednesday will be 2087.
  • the year 2082 will be a common year starting on Thursday: its first two months will correspond to those in the 2071 calendar year and its subsequent 10 months will correspond to those in the 2076 calendar year. Of course, since neither 2071 nor 2082 is a leap year these two years correspond in their entirety. After this year, the next common year that starts on Thursday will be 2093.
  • the year 2083 will be a common year starting on Friday: the year as a whole will correspond to the 2077 calendar year. After this year, the next common year that starts on Friday will be 2094.
  • the year 2084 will be a leap year starting on Saturday: its first two months, except February 29, will correspond to those of the 2078 calendar year and its subsequent 10 months will correspond to those in the 2079 calendar year. The year as a whole will correspond to the 2056 calendar year. 29 February will be a Tuesday. After this year, the next leap year that begins on a Saturday will be 2124.
  • the year 2085 will be common year starting on Monday: its first 2 months will correspond, apart from February 29, to those of the 2080 calendar year and its subsequent 10 months will correspond to the 2074 calendar year. Of course, since neither 2074 nor 2085 is a leap year these two years correspond in their entirety. The next common year starting on Monday after this year is 2091.
  • the year 2086 will be common year starting on Tuesday: its first 2 months will correspond to those of the 2075 calendar year and its subsequent 10 months will correspond to the 2080 calendar year. Of course, since neither 2075 nor 2086 is a leap year these two years correspond in their entirety. The next common year starting on Tuesday after this year is 2097.
  • the year 2087 will be common year starting on Wednesday: the year as a whole will correspond to the 2081 calendar year. The next common year starting on Wednesday after this year is 2098.
  • the year 2088 will be leap year starting on Thursday: its first 2 months, except 29 February, will correspond to those of the 2082 calendar year and its subsequent 10 months will correspond to the 2083 calendar year. The year as a whole will correspond to the 2060 calendar year. 29 February will be a Sunday. After this year, The next leap year starting on a Thursday will be 2128.
  • the year 2089 will be common year starting on Saturday: its first 2 months will correspond, apart from February 29, to those of the 2084 calendar year and its subsequent 10 months will correspond to the 2078 calendar year. Of course, since neither 2078 nor 2089 is a leap year these two years correspond in their entirety. The next common year starting on Saturday after this year will be 2095.
  • the year 2090 will be a common year starting on Sunday: its first 2 months will correspond to those of the 2079 calendar year and its subsequent 10 months will correspond to the 2084 calendar year. Of course, since neither 2079 nor 2090 is a leap year these two years correspond in their entirety. The next common year starting on Sunday after this year will be 2102.
  • the year 2091 will be common year starting on Monday: the year as a whole will correspond to the 2085 calendar year. The next common year starting on Monday after this year will be 2103.
  • the year 2092 will be leap year starting on Tuesday: its first 2 months, except 29 February, will to those of the 2086 calendar year and its subsequent 10 months will correspond to the 2087 calendar year. The year as a whole will correspond to the 2064 calendar year. 29 February was a Friday. After this year, the next leap year starting on a Tuesday will be 2104.
  • the year 2093 will be common year starting on Thursday: its first 2 months will correspond, apart from February 29, to those of the 2088 calendar year and its subsequent 10 months will correspond to the 2082 calendar year. Of course, since neither 2082 nor 2093 was a leap year these two years correspond in their entirety. The next common year starting on Thursday after this year will be 2099.
  • the year 2094 will be common year starting on Friday: its first 2 months will correspond to those of the 2083 calendar year and its subsequent 10 months will correspond to the 2088 calendar year. Of course, since neither 2083 nor 2094 was a leap year these two years correspond in their entirety. The next common year starting on a Friday after this year will be 2100.
  • the year 2095 will be common year starting on Saturday: the year as a whole will correspond to the 2089 calendar year. The next common year starting on Saturday after this year will be 2101.
  • the year 2096 will be leap year starting on Sunday: its first 2 months, except 29 February, will correspond to those of the 2090 calendar year and its subsequent 10 months will correspond to the 2091 calendar year. The year as a whole will correspond to the 2068 calendar year. 29 February will be a Wednesday. The next leap year that starts on a Sunday after this year will be 2108.
  • the year 2097 will be common year starting on Tuesday: its first 2 months will correspond, apart from February 29, to those of the 2092 calendar year and its subsequent 10 months will correspond to the 2086 calendar year. Of course, since neither 2086 nor 2097 will a leap year these two years correspond in their entirety. After this year, the next common year starting on Tuesday will be 2109.
  • the year 2098 will be common year starting on Wednesday: its first 2 months will correspond to those of the 2087 calendar year and its subsequent 10 months will correspond to the 2092 calendar year. Of course, since neither 2087 nor 2098 is a leap year these two years correspond in their entirety. The next common year starting on Wednesday after this year will be 2110.
  • the year 2099 will be common year starting on Thursday: the year as a whole will correspond to the 2093 calendar year. The next common year starting on Thursday after this year will be 2105.
  • the year 2100 will be a common year starting on Friday: the year as a whole will correspond to the 2094 calendar year. The next common year starting on Friday after this year will be 2106.
  • the year 2101 will be common year starting on Saturday: the year as a whole will correspond to the 2095 calendar year. The next common year starting on Saturday after this year will be 2107.
  • the year 2102 will be a common year starting on Sunday: its first 2 months will correspond to those of the 2096 calendar year and its subsequent 10 months will correspond to the 2090 calendar year. Of course, since neither 2090 nor 2102 will be a leap year these two years correspond in their entirety. The next common year starting on a Sunday after this year will be 2113.
  • the year 2103 will be a common year starting on Monday: its first 2 months, apart from February 29, will correspond to those in the 2091 calendar year and its subsequent 10 months will correspond to the 2096 calendar year. Of course, since neither 2091 nor 2103 is a leap year these two years correspond in their entirety.
  • the year 2104 will be a leap year starting on Tuesday: its first 2 months, except 29 February, will correspond to those of the 2097 calendar year and its subsequent 10 months will correspond to the 2098 calendar year. The year as a whole will correspond to the 2092 calendar year. 29 February will be a Friday. After this year, the next leap year that starts on a Tuesday will be 2132.
  • the year 2105 will be a common year starting on Thursday: the year as a whole will correspond to the 2099 calendar year.
  • the year 2106 will be a common year starting on Friday: the year as a whole will correspond to the 2100 calendar year.
  • the year 2107 will be a common year starting on Saturday: the year as a whole will correspond to the 2101 calendar year.
  • the year 2108 will be a leap year starting on Sunday: its first 2 months, except 29 February, will correspond to those of the 2102 calendar year and its subsequent 10 months will correspond to the 2103 calendar year. The year as a whole will correspond to the 2096 calendar year. 29 February was a Thursday. The next leap year starting on a Sunday will be 2136.
  • Based on the information above, each leap year repeats once every 28 years, and every common year repeats once every 6 years and twice every 11 years. For instance, the last occurrence of a leap year starting on a Tuesday was 2008 and the next occurrence will be 2036. Likewise, the next common years starting on Wednesday will be 2025, 2031, 2042, and then 2053. Both of these statements are true unless a leap year is skipped, but that will not happen until 2100. In the case where a century year is not a leap year, the next leap year will occur 40 years after any leap year between 12 and 28 years, inclusive, away from that century year, and any leap year within 12 years away from the century year will occur again 12 years later.

For details see the table below.

Year of the
century mod 28
y
00 06 12 17 23 0
01 07 12 18 24 1
02 08 13 19 24 2
03 08 14 20 25 3
04 09 15 20 26 4
04 10 16 21 27 5
05 11 16 22 00 6

Notes:

  • Black means all the months of Common Year
  • Red means the first 2 months of Leap Year
  • Blue means the last 10 months of Leap Year

Corresponding centuries[edit]

Julian century
mod 700
Gregorian century
mod 400[6]
Day
400: 1100 1800 ... 300: 1500 1900 ... Sun
300: 1000 1700 ... Mon
200 0900 1600 ... 200: 1800 2200 ... Tue
100 0800 1500 ... Wed
700: 1400 2100 ... 100: 1700 2100 ... Thu[7]
600: 1300 2000 ... Fri
500: 1200 1900 ... 000: 1600 2000 ... Sat

"Year 000" is, in normal chronology, the year 1 BC (which precedes AD 1). In astronomical year numbering the year 0 comes between 1 BC and AD 1. In the proleptic Julian calendar, (that is, the Julian calendar as it would have been if it had been operated correctly from the start), 1 BC starts on Thursday. In the proleptic Gregorian calendar, (so called because it wasn't devised until 1582), 1 BC starts on Saturday.

Tabular methods to calculate the day of the week[edit]

Complete table: Julian and Gregorian calendars[edit]

For Julian dates before 1300 and after 1999 the year in the table which differs by an exact multiple of 700 years should be used. For Gregorian dates after 2299, the year in the table which differs by an exact multiple of 400 years should be used. The values "r0" through "r6" indicate the remainder when the Hundreds value is divided by 7 and 4 respectively, indicating how the series extend in either direction. Both Julian and Gregorian values are shown 1500-1999 for convenience. Bold figures (e.g., 04) denote leap year. If a year ends in 00 and its hundreds are in bold it is a leap year. Thus 19 indicates that 1900 is not a Gregorian leap year, (but 19 in the Julian column indicates that it is a Julian leap year, as are all Julian x00 years). 20 indicates that 2000 is a leap year. Use Jan and Feb only in leap years.

Hundreds of Years Remaining Year Digits Month D
o
W
#
Julian
(r ÷ 7)
Gregorian
(r ÷ 4)
r5 19 16 20 r0 00 06   17 23 28 34   45 51 56 62   73 79 84 90 Jan Oct Sa 0
r4 18 15 19 r3 01 07 12 18 29 35 40 46 57 63 68 74 85 91 96 May Su 1
r3 17
N/A
02   13 19 24 30   41 47 52 58   69 75 80 86   97 Feb Aug M 2
r2 16 18 22 r2 03 08 14   25 31 36 42   53 59 64 70   81 87 92 98 Feb Mar Nov Tu 3
r1 15
N/A
  09 15 20 26   37 43 48 54   65 71 76 82   93 99 Jun W 4
r0 14 17 21 r1 04 10   21 27 32 38   49 55 60 66   77 83 88 94 Sep Dec Th 5
r6 13
N/A
05 11 16 22 33 39 44 50 61 67 72 78 89 95 Jan Apr Jul F 6

For determination of the day of the week (1 January 2000, Saturday)

  • the day of the month: 1 ~ 31 (1)
  • the month: (6)
  • the year: (0)
  • the century mod 4 for the Gregorian calendar and mod 7 for the Julian calendar (0).
  • adding 1+6+0+0=7. Dividing by 7 leaves a remainder of 0, so the day of the week is Saturday.

The formula is w = (d + m + y + c) mod 7.

Revised Julian calendar[edit]

Note that the date (and hence the day of the week) in the Revised Julian and Gregorian calendars is the same from 14 October 1923 to 28 February AD 2800 inclusive and that for large years it may be possible to subtract 6300 or a multiple thereof before starting so as to reach a year which is within or closer to the table.

To look up the weekday of any date for any year using the table, subtract 100 from the year, divide the difference by 100, multiply the resulting quotient (omitting fractions) by seven and divide the product by nine. Note the quotient (omitting fractions). Enter the table with the Julian year, and just before the final division add 50 and subtract the quotient noted above.

Example: What is the day of the week of 27 January 8315?

8315-6300=2015, 2015-100=1915, 1915/100=19 remainder 15, 19x7=133, 133/9=14 remainder 7. 2015 is 700 years ahead of 1315, so 1315 is used. From table: for hundreds (13): 6. For remaining digits (15): 4. For month (January): 0. For date (27): 27. 6+4+0+27+50-14=73. 73/7=10 remainder 3. Day of week = Tuesday.

Dominical Letter[edit]

To find the Dominical Letter, calculate the day of the week for either 1 January or 1 October. If it is Sunday, the Dominical Letter is A, if Saturday B, and similarly backwards through the week and forwards through the alphabet to Monday, which is G.

Leap years have two Sunday Letters, so for January and February calculate the day of the week for 1 January and for March to December calculate the day of the week for 1 October.

Leap years are all years which divide exactly by four with the following exceptions:

In the Gregorian calendar - all years which divide exactly by 100 (other than those which divide exactly by 400).

In the Revised Julian calendar - all years which divide exactly by 100 (other than those which give remainder 200 or 600 when divided by 900).

The "doomsday"[edit]

This is an artefact of recreational mathematics. See doomsday rule for an explanation.

Check the result[edit]

Use this table for finding the day of the week without any calculations.

Index Mon
A
Tue
B
Wed
C
Thu
D
Fri
E
Sat
F
Sun
G
Perpetual Gregorian and Julian calendar
Use Jan and Feb for leap years
Date letter in year row for the letter in century row

All the C days are doomsdays

Julian
century
Gregorian
century
Date 01
08
15
22
29
02
09
16
23
30
03
10
17
24
31
04
11
18
25

05
12
19
26

06
13
20
27

07
14
21
28

12 19 16 20 Apr Jul Jan G A B C D E F 01 07 12 18 29 35 40 46 57 63 68 74 85 91 96
13 20 Sep Dec F G A B C D E 02 13 19 24 30 41 47 52 58 69 75 80 86 97
14 21 17 21 Jun E F G A B C D 03 08 14 25 31 36 42 53 59 64 70 81 87 92 98
15 22 Feb Mar Nov D E F G A B C 09 15 20 26 37 43 48 54 65 71 76 82 93 99
16 23 18 22 Aug Feb C D E F G A B 04 10 21 27 32 38 49 55 60 66 77 83 88 94
17 24 May B C D E F G A 05 11 16 22 33 39 44 50 61 67 72 78 89 95
18 25 19 23 Jan Oct A B C D E F G 06 17 23 28 34 45 51 56 62 73 79 84 90 00
[Year/100] Gregorian
century
20
16
21
17
22
18
23
19
Year mod 100
Julian
century
19
12
20
13
21
14
22
15
23
16
24
17
25
18

Examples:

  • For common method
December 26, 1893 (GD)

December is in row F and 26 is in column E, so the letter for the date is C located in row F and column E. 93 (year mod 100) is in row D (year row) and the letter C in the year row is located in column G. 18 ([year/100] in the Gregorian century column) is in row C (century row) and the letter in the century row and column G is B, so the day of the week is Tuesday.

October 13, 1307 (JD)

October 13 is a F day. The letter F in the year row (07) is located in column G. The letter in the century row (13) and column G is E, so the day of the week is Friday.

January 1, 2000 (GD)

January 1 corresponds to G, G in the year row (00) corresponds to F in the century row (20), and F corresponds to Saturday.

A pithy formula for the method: "Date letter (G), letter (G) is in year row (00) for the letter (F) in century row (20), and for the day, the letter (F) become weekday (Saturday)".

The Sunday Letter method

Each day of the year (other than 29 February) has a letter allocated to it in the recurring sequence ABCDEFG. The series begins with A on 1 January and continues to A again on 31 December. The Sunday letter is the one which stands against all the Sundays in the year. Since 29 February has no letter, this means that the Sunday Letter for March to December is one step back in the sequence compared to that for January and February. The letter for any date will be found where the row containing the month (in black) at the left of the "Latin square" meets the column containing the date above the "Latin square". The Sunday letter will be found where the column containing the century (below the "Latin square") meets the row containing the year's last two digits to the right of the "Latin square". For a leap year, the Sunday letter thus found is the one which applies to March to December.

So, for example, to find the weekday of 16 June 2020:

Column "20" meets row "20" at "D". Row "June" meets column "16" at "F". As F is two letters on from D, so the weekday is two days on from Sunday, i.e. Tuesday.

Mathematical algorithms[edit]

A simple solution[edit]

  • A year that follows a common year (52 weeks and one day), always begins one weekday later than the common year did.
  • A year that follows a leap year (52 weeks and two days), always begins two weekdays later than the leap year did.

Weekdays may be calculated easily (based on Augustus De Morgan's rule):

Weekday number in the Gregorian calendar,         wdnog = (dayno + year + (year − 1) div 4 − (year − 1) div 100 + (year − 1) div 400 − 2) mod 7 + 1
Weekday number in the Julian calendar (year ≥ 5), wdnoj = (dayno + year + (year − 1) div 4 + 3) mod 7 + 1
where
dayno = 1 → 365/366, year is a year number, div means integer division (i.e. the remainder after a division is discarded) and mod gives the remainder after an integer division.

When using serial numbers for dates (e.g. in spreadsheets) dayno = serial number for a date − serial number for 31st December of the previous year (or the serial number for 1st January the same year + 1).

Both formulae are easy to remember when you know the leap year rules.

To find the dayno when serial numbers are not used, one of the tables below may be useful.

      Find dayno
Month no. 1 2 3 4 5 6 7 8 9 10 11 12  or  Month no. 1 2 3 4 5 6 7 8 9 10 11 12
No. of days 0 31 59 90 120 151 181 212 243 273 304 334 Approx. days 30 × (month no. − 1)
Adjustment 0 + 1 − 1 0 + 1 + 2 + 3 + 4
If leap year 0 + 1 If leap year 0 + 1
Day of month + 1, …, 28, 29, 30, 31 Day of month + 1, …, 28, 29, 30, 31
Total sum = dayno Total sum = dayno

The weekday numbers 1, …, 7 correspond to the weekdays Monday, …, Sunday respectively (as in ISO 8601).

Example: Find the weekday of 16th December 1770 (in the Gregorian calendar):

wdnog = ((30 × (12 − 1) + 4 + 16) + 1770 + (1770 − 1) div 4 + (1770 − 1) div 400 − (1770 − 1) div 100 − 2) mod 7 + 1
wdnog = ((330 + 4 + 16) + 1770 + 1769 div 4 + 1769 div 400 − 1769 div 100 − 2) mod 7 + 1
wdnog = (350 + 1770 + 442 + 4 − 17 − 2) mod 7 + 1
wdnog = (2566 − 19) mod 7 + 1
wdnog = 2547 mod 7 + 1
wdnog = 6 + 1 = 7.

wdnog = ((98967 − 98617) + 1770 + (1770 − 1) div 4 + (1770 − 1) div 400 − (1770 − 1) div 100 − 2) mod 7 + 1
wdnog = (350 + 1770 + 1769 div 4 + 1769 div 400 − 1769 div 100 − 2) mod 7 + 1
wdnog = (350 + 1770 + 442 + 4 − 17 − 2) mod 7 + 1
wdnog = (2566 − 19) mod 7 + 1
wdnog = 2547 mod 7 + 1
wdnog = 6 + 1 = 7.

So Ludwig van Beethoven was born Sunday 16th December 1770 (3rd Sunday in Advent).

Gauss's algorithm[edit]

In a handwritten note in a collection of astronomical tables, Carl Friedrich Gauss described a method for calculating the day of the week for 1 January in any given year.[8] He never published it. It was finally included in his collected works in 1927.[9]

Gauss' method was applicable to the Gregorian calendar. He numbered the weekdays from 0 to 6 starting with Sunday. He defined the following operation: The weekday of 1 January in year number A is[8]

or

from which a method for the Julian calendar can be derived

or

where is the remainder after division of y by m,[9] or y modulo m, and Y + 100C = A.

For year number 2000, A - 1 = 1999, Y - 1 = 99 and C = 19, the weekday of 1 January is

The weekday of the last day in year number A - 1 or 0 January in year number A is

The weekday of 0 (a common year) or 1 (a leap year) January in year number A is

In order to determine the week day of an arbitrary date, we will use the following lookup table.

Months 11
Jan
12
Feb
1
Mar
2
Apr
3
May
4
Jun
5
Jul
6
Aug
7
Sep
8
Oct
9
Nov
10
Dec
M
Common years 0 3 3 6 1 4 6 2 5 0 3 5 m
Leap years 4 0 2 5 0 3 6 1 4 6
Algorithm

Note: minus 1 if M is 11 or 12 and plus 1 if M less than 11 in a leap year.

The day of the week for any day in year number A is

or

where D is the day of the month and A - 1 for Jan or Feb.

The weekdays for 30 April 1777 and 23 February 1855 are

and

This formula was also converted into graphical and tabular methods for calculating any day of the week by Kraitchik and Schwerdtfeger.[9][10]

Disparate variation[edit]

Another variation of the above algorithm likewise works with no lookup tables. A slight disadvantage is the unusual month and year counting convention. The formula is

where

  • Y is the year minus 1 for January or February, and the year for any other month
  • y is the last 2 digits of Y
  • c is the first 2 digits of Y
  • d is the day of the month (1 to 31)
  • m is the shifted month (March=1,...,February=12)
  • w is the day of week (0=Sunday,...,6=Saturday). If w is negative you have to add 7 to it.

For example, January 1, 2000. (year - 1 for January)

Note: The first is only for a 00 leap year and the second is for any 00 years.

The term gives the values of months: m

Months m
January 0
February 3
March 2
April 5
May 0
June 3
July 5
August 1
September 4
October 6
November 2
December 4

The term gives the values of years: y

y mod 28 y
01 07 12 18 -- 1
02-13 19 24 2
03 08 14-25 3
-- 09 15 20 26 4
04 10-21 27 5
05 11 16 22 -- 6
06-17 23 00 0

The term gives the values of centuries: c

c mod 4 c
1 5
2 3
3 1
0 0

Now from the general formula: ; January 1, 2000 can be recalculated as follows:

Zeller's algorithm[edit]

In Zeller's algorithm, the months are numbered from 3 for March to 14 for February. The year is assumed to begin in March; this means, for example, that January 1995 is to be treated as month 13 of 1994.[11] The formula for the Gregorian calendar is

where

  • Y is the year minus 1 for January or February, and the year for any other month
  • y is the last 2 digits of Y
  • c is the first 2 digits of Y
  • d is the day of the month (1 to 31)
  • m is the shifted month (March=3,...January = 13, February=14)
  • w is the day of week (1=Sunday,..0=Saturday)

The only difference is one between Zeller's algorithm (Z) and the Gaussian algorithm (G), that is Z - G = 1 = Sunday.

(March = 3 in Z but March = 1 in G)

So we can get the values of months from those for the Gaussian algorithm by adding one:

Months m
January 1
February 4
March 3
April 6
May 1
June 4
July 6
August 2
September 5
October 0
November 3
December 5

Wang's algorithm[edit]

Wang's algorithm [12] for the Gregorian calendar is (the formula should be subtracted by 1 if m is 1 or 2 and the year is a leap year)

where

  • is the last digit of the year
  • is the last second digit of the year
  • is the first 2 digits of the year
  • is the day of the month (1 to 31)
  • is the month (January=1,...December=12)
  • is the day of the week (0=Sunday,..6=Saturday)
  • is the null-days function with values listed in the following table
m
1 1 A day
3 5 m + 2
5 7
7 9
9 3 m + 1
11 12
2 12 m + 3
4 2 m - 2
6 4
8 6
10 8
12 10

An algorithm for the Julian calendar can be derived from the algorithm above

where is a doomsday.

m
1 3 C day
3 7 m + 4
5 9
7 11
9 5 m - 4
11 7
2 0 m - 2
4 4 m
6 6
8 8
10 10
12 12

Other algorithms[edit]

Schwerdtfeger's method[edit]

In a partly tabular method by Schwerdtfeger, the year is split into the century and the two digit year within the century. The approach depends on the month. For m ≥ 3,

so g is between 0 and 99. For m = 1,2,

The formula for the day of the week is[9]

where the positive modulus is chosen.[9]

The value of e is obtained from the following table:

m 1 2 3 4 5 6 7 8 9 10 11 12
e 0 3 2 5 0 3 5 1 4 6 2 4

The value of f is obtained from the following table, which depends on the calendar. For the Gregorian calendar,[9]

c mod 4 0 1 2 3
f 0 5 3 1

For the Julian calendar,[9]

c mod 7 0 1 2 3 4 5 6
f 5 4 3 2 1 0 6

Lewis Carroll's method[edit]

Charles Lutwidge Dodgson (Lewis Carroll) devised a method resembling a puzzle, yet partly tabular in using the same index numbers for the months as in the "Complete table: Julian and Gregorian calendars" above. He lists the same three adjustments for the first three months of non-leap years, one 7 higher for the last, and gives cryptic instructions for finding the rest; his adjustments for centuries are to be determined using formulas similar to those for the centuries table. Although explicit in asserting that his method also works for Old Style dates, his example reproduced below to determine that "1676, February 23" is a Wednesday only works on a Julian calendar which starts the year on January 1, instead of March 25 as on the "Old Style" Julian calendar.

Algorithm:[13]

Take the given date in 4 portions, viz. the number of centuries, the number of years over, the month, the day of the month.

Compute the following 4 items, adding each, when found, to the total of the previous items. When an item or total exceeds 7, divide by 7, and keep the remainder only.

Century-item: For 'Old Style' (which ended 2 September 1752) subtract from 18. For 'New Style' (which began 14 September 1752) divide by 4, take overplus from 3, multiply remainder by 2.

Year-item: Add together the number of dozens, the overplus, and the number of 4s in the overplus.

Month-item: If it begins or ends with a vowel, subtract the number, denoting its place in the year, from 10. This, plus its number of days, gives the item for the following month. The item for January is "0"; for February or March, "3"; for December, "12".

Day-item: The total, thus reached, must be corrected, by deducting "1" (first adding 7, if the total be "0"), if the date be January or February in a leap year, remembering that every year, divisible by 4, is a Leap Year, excepting only the century-years, in `New Style', when the number of centuries is not so divisible (e.g. 1800).

The final result gives the day of the week, "0" meaning Sunday, "1" Monday, and so on.

Examples:[13]

1783, September 18

17, divided by 4, leaves "1" over; 1 from 3 gives "2"; twice 2 is "4". 83 is 6 dozen and 11, giving 17; plus 2 gives 19, i.e. (dividing by 7) "5". Total 9, i.e. "2" The item for August is "8 from 10", i.e. "2"; so, for September, it is "2 plus 31", i.e. "5" Total 7, i.e. "0", which goes out. 18 gives "4". Answer, "Thursday".

1676, February 23

16 from 18 gives "2" 76 is 6 dozen and 4, giving 10; plus 1 gives 11, i.e. "4". Total "6" The item for February is "3". Total 9, i.e. "2" 23 gives "2". Total "4" Correction for Leap Year gives "3". Answer, "Wednesday".

Since 23 February 1676 (counting February as the second month) is, for Carroll, the same day as Gregorian 4 March 1676, he fails to arrive at the correct answer, namely "Friday," for an Old Style date that on the Gregorian calendar is the same day as 5 March 1677. Had he correctly assumed the year to begin on the 25th of March, his method would have accounted for differing year numbers - just like George Washington's birthday differs - between the two calendars.

It is noteworthy that those who have republished Carroll's method have failed to point out his error, most notably Martin Gardner.[14]

In 1752, the British Empire abandoned its use of the Old Style Julian calendar upon adopting the Gregorian calendar, which has become today's standard in most countries of the world. For more background, see Old Style and New Style dates.

Implementation-dependent methods[edit]

In the C language expressions below, y, m and d are, respectively, integer variables representing the year (e.g., 1988), month (1-12) and day of the month (1-31).

        (d+=m<3?y--:y-2,23*m/9+d+4+y/4-y/100+y/400)%7  

In 1990, Michael Keith and Tom Craver published the foregoing expression that seeks to minimise the number of keystrokes needed to enter a self-contained function for converting a Gregorian date into a numerical day of the week.[15] It preserves neither y nor d, and returns 0 = Sunday, 1 = Monday, etc.

Shortly afterwards, Hans Lachman streamlined their algorithm for ease of use on low-end devices. As designed originally for four-function calculators, his method needs fewer keypad entries by limiting its range either to A.D. 1905–2099, or to historical Julian dates. It was later modified to convert any Gregorian date, even on an abacus. On Motorola 68000-based devices, there is similarly less need of either processor registers or opcodes, depending on the intended design objective.[16]

Sakamoto's methods[edit]

The tabular forerunner to Tøndering's algorithm is embodied in the following K&R C function.[17] With minor changes, it was adapted for other high level programming languages such as APL2.[18] Posted by Tomohiko Sakamoto on the comp.lang.c Usenet newsgroup in 1992, it is accurate for any Gregorian date.[19][20]

    dayofweek(y, m, d)	/* 1 <= m <= 12,  y > 1752 (in the U.K.) */
    {
        static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
        if( m < 3 )
        {
          y -= 1;
        }
        return (y + y/4 - y/100 + y/400 + t[m-1] + d) % 7;
    }

The function does not always preserve y, and returns 0 = Sunday, 1 = Monday, etc. In contrast, the following expression

    dow(m,d,y) { y-=m<3; return(y+y/4-y/100+y/400+"-bed=pen+mad."[m]+d)%7; }

posted simultaneously by Sakamoto is not easily adaptable to other languages, and may even fail if compiled on a computer that encodes characters using other than standard ASCII values (e.g. EBCDIC), or on C compilers that enforce ANSI C compliance (even on code that is still compliant with the original K&R C specification, where omitted type declarations are assumed to be integer). For the latter consideration alone, Sakamoto's more-verbose version might be considered non-portable, as might also that of Keith and Craver.

Rata Die[edit]

IBM's Rata Die method requires that one know the "key day" of the proleptic Gregorian calendar i.e. the day of the week of January 1, AD 1 (its first date). This has to be done to establish the remainder number based on which the day of the week is determined for the latter part of the analysis. By using a given day August 13, 2009 which was a Thursday as a reference, with Base and n being the number of days and weeks it has been since 01/01/0001 to the given day, respectively and k the day into the given week which must be less than 7, Base is expressed as

                      Base = 7n + k       (i)

Knowing that a year divisible by 4 or 400 is a leap year while a year divisible by 100 and not 400 is not a leap year, a software program can be written to find the number of days. The following is a translation into C of IBM's method for its REXX programming language.

int daystotal (int y, int m, int d)
{
	static char daytab[2][13] =
	{
		{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
		{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
	};
	int daystotal = d;
	for (int year = 1 ; year <= y ; year++)
	{
		int max_month = ( year < y ? 12 : m-1 );
		int leap = (year%4 == 0);
		if (year%100 == 0 && year%400 != 0)
			leap = 0;
		for (int month = 1 ; month <= max_month ; month++)
		{
			daystotal += daytab[leap][month];
		}
	}
	return daystotal;
}

It is found that daystotal is 733632 from the base date January 1, AD 1. This total number of days can be verified with a simple calculation: There are already 2008 full years since 01/01/0001. The total number of days in 2008 years not counting the leap days is 365 *2008 = 732920 days. Assume that all years divisible by 4 are leap years. Add 2008/4 = 502 to the total; then subtract the 15 leap days because the years which are exactly divisible by 100 but not 400 are not leap. Continue by adding to the new total the number of days in the first seven months of 2009 that have already passed which are 31 + 28 + 31 + 30 + 31 + 30 + 31 = 212 days and the 13 days of August to get Base = 732920 + 502 - 20 + 5 + 212 + 13 = 733632.

What this means is that it has been 733632 days since the base date. Substitute the value of Base into the above equation (i) to get 733632 = 7 *104804 + 4, n = 104804 and k = 4 which implies that August 13, 2009 is the fourth day into the 104805th week since 01/01/0001. 13 August 2009 is Thursday; therefore, the first day of the week must be Monday, and it is concluded that the first day 01/01/0001 of the calendar is Monday. Based on this, the remainder of the ratio Base/7, defined above as k, decides what day of the week it is. If k = 0, it's Monday, k = 1, it's Tuesday, etc.[21]

See also[edit]

References[edit]

  1. ^ To explain this in detail, visualise a calendar hanging on the wall depicting a month beginning on Sunday (e.g. March 2020). You will see that the 1st is a Sunday. Now count forward seven days. This brings you to the 8th, which is also a Sunday. Count forward ten days. This brings you to the 18th, which is a Wednesday. Now the 4th is a Wednesday (being three days after Sunday 1st). Count forward seven days. This brings you to Wednesday 11th, three days after Sunday 8th. Count forward another seven days. This brings you to Wednesday 18th, three days after Sunday 15th, which falls two weeks after Sunday 1st.
  2. ^ a b Brothers, Hardin; Rawson, Tom; Conn, Rex C.; Paul, Matthias R.; Dye, Charles E.; Georgiev, Luchezar I. (2002-02-27). 4DOS 8.00 online help.
  3. ^ "HP Prime - Portal: Firmware update" (in German). Moravia Education. 2015-05-15. Archived from the original on 2016-11-05. Retrieved 2015-08-28.
  4. ^ Paul, Matthias R. (1997-07-30). NWDOS-TIPs — Tips & Tricks rund um Novell DOS 7, mit Blick auf undokumentierte Details, Bugs und Workarounds. MPDOSTIP. Release 157 (in German) (3rd ed.). Archived from the original on 2016-11-04. Retrieved 2014-08-06. (NB. NWDOSTIP.TXT is a comprehensive work on Novell DOS 7 and OpenDOS 7.01, including the description of many undocumented features and internals. It is part of the author's yet larger MPDOSTIP.ZIP collection maintained up to 2001 and distributed on many sites at the time. The provided link points to a HTML-converted older version of the NWDOSTIP.TXT file.)
  5. ^ Richards, E. G. (1999). Mapping Time: The Calendar and Its History. Oxford University Press.
  6. ^ The numbers in the first column are proleptic - the Gregorian calendar was not devised till 1582. See the note beneath the table.
  7. ^ The Julian century beginning 1 BC would also appear on this line of the table (to the left of 700) but there is no space to include it.
  8. ^ a b Gauss, Carl F. (1981). "Den Wochentag des 1. Januar eines Jahres zu finden. Gueldene Zahl. Epakte. Ostergrenze.". Werke. herausgegeben von der Koeniglichen Gesellschaft der Wissenschaften zu Goettingen (2nd ed.). Hildesheim: Georg Olms Verlag. pp. 206–207. ISBN 978-3-48704643-3.
  9. ^ a b c d e f g Schwerdtfeger, Berndt E. (2010-05-07). "Gauss' calendar formula for the day of the week" (PDF) (1.4.26 ed.). Retrieved 2012-12-23.
  10. ^ Kraitchik, Maurice (1942). "Chapter 5: The calendar". Mathematical recreations (2nd revised [Dover] ed.). Mineola: Dover Publications. pp. 109–116. ISBN 978-0-48645358-3.
  11. ^ Stockton, J. R. (2010-03-19). "The Calendrical Works of Rektor Chr. Zeller: The Day-of-Week and Easter Formulae". Merlyn. Retrieved 2012-12-19.
  12. ^ Wang, Xiang-Sheng (March 2015). "Calculating the day of the week: null-days algorithm" (PDF). Recreational Mathematics Magazine. No. 3. p. 5.
  13. ^ a b Dodgson, C.L. (Lewis Carroll). (1887). "To find the day of the week for any given date". Nature, 31 March 1887. Reprinted in Mapping Time, pp. 299-301.
  14. ^ Martin Gardner. (1996). The Universe in a Handkerchief: Lewis Carroll's Mathematical Recreations, Games, Puzzles, and Word Plays, pages 24-26. Springer-Verlag.
  15. ^ Michael Keith; Tom Craver. (1990). The ultimate perpetual calendar? Journal of Recreational Mathematics, 22:4, pp.280-282.
  16. ^ The 4-function Calculator; The Assembly of Motorola 68000 Orphans; The Abacus. gopher://sdf.org/1/users/retroburrowers/TemporalRetrology
  17. ^ "Day-of-week algorithm NEEDED!" news:1993Apr20.075917.16920@sm.sony.co.jp
  18. ^ APL2 IDIOMS workspace: Date and Time Algorithms, line 15. ftp://ftp.software.ibm.com/ps/products/apl2/info/APL2IDIOMS.pdf (2002)
  19. ^ Google newsgroups:comp.lang.c. (December 1992). "Date -> Day of week conversion". Retrieved 2020-06-21.
  20. ^ Google newsgroups:comp.lang.c. (1994). "DOW algorithm". Retrieved 2020-06-21.
  21. ^ REXX/400 Reference manual page 87 (1997).
  • Hale-Evans, Ron (2006). "Hack #43: Calculate any weekday". Mind performance hacks (1st ed.). Beijing: O'Reilly. pp. 164–169. ISBN 9780596101534.
  • Thioux, Marc; Stark, David E.; Klaiman, Cheryl; Schultz, Robert T. (2006). "The day of the week when you were born in 700 ms: Calendar computation in an autistic savant". Journal of Experimental Psychology: Human Perception and Performance. 32 (5): 1155–1168. doi:10.1037/0096-1523.32.5.1155. PMID 17002528.
  • Treffert, Darold A. (2011-10-12). "Why calendar calculating?". Islands of genius : the bountiful mind of the autistic, acquired, and sudden savant (1. publ., [repr.]. ed.). London: Jessica Kingsley. pp. 63–66. ISBN 9781849058735.

External links[edit]