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 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, the number 8 as 1, the number 9 as 2, the number 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 (i.e.).

Standard Monday Tuesday Wednesday Thursday Friday Saturday Sunday Usage examples ISO 8601 1 2 3 4 5 6 7 (4DOS); (HP Prime) 0 1 2 3 4 5 6 2 3 4 5 6 7 1 (NetWare, DR-DOS (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.)); (4DOS) 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 1 January 1800 as a Wednesday), determining the number of days between the known day and the day 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, applying modulo 7 to the day count allows determining the day of the week of that date.

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 can have practical use: the former is easier for calculators and computer programs, whereas the latter is easier for mental calculation. None of the methods given here perform range checks, so unreasonable dates will produce erroneous results.

Corresponding days Every seventh day in a month has the same name as the previous: Day ofthe month 00 07 14 21 28 001 08 15 22 29 102 09 16 23 30 203 10 17 24 31 304 11 18 25 405 12 19 26 506 13 20 27 6

Corresponding months "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 1 September falls on the same day as 1 December (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 29 February 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 yearsLeap yearsAll years Jan Oct 0 May 1 Feb Aug 2 Feb Mar Nov 3 Jun 4 Sept Dec 5 Jan Apr July 6

Corresponding years

There are seven possible days that a year can start on, and leap years will alter the day of the week after 29 February. This means that there are 14 configurations that a year can have. All the configurations can be referenced by a dominical letter, but as 29 February 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.

2025 is a common year starting on Wednesday, which means that it corresponds to the 2014 calendar year. The first two months of 2025 correspond to the first two months of 2020. 2026 is a common year starting on Thursday, which means that it corresponds to the 2015 calendar year. The last ten months of 2026 correspond to the last ten months of 2020. 2027 is a common year starting on Friday, which means that it corresponds to the 2021 calendar year. 2028 is a leap year starting on Saturday, which means that it corresponds to the 2000 calendar year. The first two months of 2028 correspond to the first two months of 2022. The last ten months of 2028 correspond to the last ten months of 2023.

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 Monday was 2024 and the next occurrence will be 2052. Likewise, the next common years starting on Wednesday will be 2031, 2042, and then 2053. Both of these statements are true unless a leap year is skipped, which will not happen until 2100.

For details, see the table below:

Year of thecentury mod 28 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 a common year Red means the first two months of a leap year Blue means the last ten months of a leap year

Corresponding centuries

Julian centurymod 700Gregorian centurymod 400Day400: 1100 1800 ...300: 1500 1900 ...Sun300: 1000 1700 ...Mon200 0900 1600 ...200: 1800 2200 ...Tue100 0800 1500 ...Wed700: 1400 2100 ...100: 1700 2100 ...Thu600: 1300 2000 ...Fri500: 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, (called such because it wasn't devised until 1582), 1 BC starts on Saturday.

Tabular methods to calculate the day of the week Complete table: Julian and Gregorian calendars 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 "" through "" 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 yearsRemaining year digitsMonthcolspan=1 rowspan=2 #Julian(r ÷ 7)Gregorian(r ÷ 4)r5 1916 20 r000 06   17 2328 34   45 5156 62   73 7984 90 Jan OctSa0r4 1815 19 r301 07 12 18 29 35 40 4657 63 68 74 85 91 96 May Su1r3 1702   13 19 2430   41 47 5258   69 75 8086   97 Feb Aug M2r2 1618 22 r203 08 14   2531 36 42   5359 64 70   8187 92 98Feb Mar NovTu3r1 15   09 15 20 26   37 43 48 54   65 71 76 82   93 99 Jun W4r0 1417 21 r104 10   21 2732 38   49 5560 66   77 8388 94 Sep DecTh5r6 1305 11 16 2233 39 44 5061 67 72 7889 95 Jan Apr Jul F6

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 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.

The following is an example of calculating the day of the week for 27 January 8315:

= 2015, = 1915, = 19 remainder 15, = 133, = 14 remainder }. 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. . . Thus, the day of the week is Thursday.

Dominical letter To find the dominical letter, calculate the day of the week for either 1 January or 1 October, and assign a letter with Sunday corresponding to A, Saturday corresponding to B, ... and Monday corresponding to 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

The Doomsday algorithm invented by the mathematician John Horton Conway computes the weekday of any date in any year in the Gregorian calendar (or, with slight modification, in the Julian calendar). It can be performed mentally as the memorization and calculation required is limited.

Result The following is a table for finding the day of the week without calculation.

Index MonA TueB WedC ThuD FriE SatF SunG Perpetual Gregorian and Julian calendarUse Jan and Feb for leap yearsDate letter in year row for the letter in century row