methods to calculate the day of the week
Wikipedia
en.wikipedia.org › wiki › Determination_of_the_day_of_the_week
Determination of the day of the week - Wikipedia
January 21, 2026 - For year number 2000, A − 1 = 1999, Y − 1 = 99 and C = 19, the weekday of 1 January is ... The algorithm for the day-of-week of 1 Jan can be proven using modulo arithmetic. The main point is that because 365 % 7 = 1, each year adds 1 day to the progression.
John D. Cook
johndcook.com › blog › 2022 › 05 › 07 › day-of-the-week
Mentally calculating the day of the week
September 18, 2025 - The result is a number that tell you the day of the week. To be even more succinct, let y be the number formed by the last two digits of the date. Let d be the day of the month. Let L equal 1 if the year is a leap year and the date is in January or February and 0 otherwise. Then the algorithm above can be written as
date - What is the easiest algorithm to find the day of week of day zero of a given year? - Stack Overflow
I am trying to figure out what the day of the week of day zero (January 1st) of a given year. So far I have looked at the Wikipedia page 'Calculating the day of the week' but I was wondering if th... More on stackoverflow.com
A cool guide how to calculate the day of the week
I'll keep that in mind in case I'm ever in a black phoneless abyss More on reddit.com
Understanding the algorithm behind day of week calculation - Computer Science Stack Exchange
I came across this algorithm recently to calculate day of the week for any year. int y0 = year - (14 - month) / 12; int x = y0 + y0/4 - y0/100 + y0/400; int m0 = month + 12*((14 - month)/12) - 2; ... More on cs.stackexchange.com
Question Regarding to Conway's Doomsday Algorithm
It's because 2100 was not a leap year. So your final calculation is Tuesday + (8 + 4 + 0) = Sunday. Incidentally, the fastest method for performing calendar calculation is this one . I used this to obtain the British record (59 dates in one minute) and the same method is used by most other top calendar calculators. More on reddit.com
Videos
This Simple Trick Lets You Calculate Any Day of the Week
11:30
Finding The Day of the Week From any Date (Better Version) - YouTube
Conway's Doomsday Algorithm
09:06
Doomsday Algorithm (Make sure to watch the very end) - YouTube
14:33
The Doomsday Algorithm - Numberphile - YouTube
08:40
Day of Week Algorithm - YouTube
University of Waterloo
cs.uwaterloo.ca › ~alopez-o › math-faq › node73.html
How to determine the day of the week, given the month, day and year
Because the leap year pattern also recurs with a four hundred year cycle, a simple table of four hundred elements, and single modulus, suffices to determine the day of the week (in the Gregorian Calendar), and does it much faster than all the other algorithms proposed.
Northern Illinois University
faculty.cs.niu.edu › ~hutchins › csci297p2 › webpages › zeller.htm
Zeller's Algorithm: Day of the Week
If Month is 1 or 2 Then A = Month+10 NewYear = Year - 1 Else A = Month-2 NewYear = Year End If B = Day C = which year of the century (that is, Mod(NewYear, 100)) D = which century (that is, NewYear / 100) W = (13 * A - 1) / 5 X = C / 4 Y = D / 4 Z = W + X + Y + B + C - 2 * D R = Mod(Z, 7) If R is less than 0 Then Add 7 to R End-If · At this point, R is an Integer value between 0 and 6, inclusive: R = 0 Sunday R = 1 Monday R = 2 Tuesday R = 3 Wednesday R = 4 Thursday R = 5 Friday R = 6 Saturday ... Suppose the date is December 2, 2009.
Top answer 1 of 11
18
Here's a simple one-liner. I've verified this for all the years 1901-2200 using Excel, and 1582-3000 using Python's datetime.
dayOfWeek = (year*365 + trunc((year-1) / 4) - trunc((year-1) / 100) +
trunc((year-1) / 400)) % 7
This will give the day of the week as 0 = Sunday, 6 = Saturday. This result can easily be adjusted by adding a constant before or after the modulo 7. For example to match Python's convention of 0 = Monday, add 6 before the modulo.
2 of 11
11
int dayofweek(y, m, d) /* 0 = Sunday */
int y, m, d; /* 1 <= m <= 12, y > 1752 or so */
{
static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
y -= m < 3;
return (y + y/4 - y/100 + y/400 + t[m-1] + d) % 7;
}
What the Day
whattheday.com
Learn the Doomsday algorithm
Performing the modulo operation, 13 modulo 7 is 6, which is Saturday. Therefore, the key to mastering the doomsday algorithm lies in getting comfortable with quickly performing these modulo operations.
GeeksforGeeks
geeksforgeeks.org › dsa › find-day-of-the-week-for-a-given-date
Find day of the week for a given date - GeeksforGeeks
February 14, 2025 - The formula: (y + y/4 − y/100 + y/400 + t[m−1] + d) % 7 calculates the day of the week by summing the day (d), month code (t[m - 1]), and adjusted year values. The result is then taken modulo 7, which gives a value between 0 and 6, corresponding ...
OpenGenus
iq.opengenus.org › algorithm-for-day-of-week
Algorithms for Calculating Day of Week
December 5, 2020 - Days in current month is d. Now using the formula (y + y/4 - y/100 + y/400 + t[m-1] + d) % 7 gives the day for the particular date. Here is the link to a more detailed article about Tomohiko Sakamoto Algorithm · Using the Georgian Calender in this weekdays are numbered from 0 to 6.
Fandom
calendars.fandom.com › wiki › Calculating_the_day_of_the_week
Calculating the day of the week | Calendar Wiki | Fandom
January 9, 2026 - The basis of nearly all the algorithms to calculate the day of the week is: Use arithmetic modulo 7 to add the number of days elapsed since the start of a known period (usually in practice a century).
DZone
dzone.com › data engineering › ai/ml › algorithm of the week: how to determine the day of the week
Algorithm of the Week: How to Determine the Day of the Week
April 24, 2012 - Because of leap years we can have a year starting on one of the seven days of the week and to be either leap or common. This means just 14 combinations. Following these observations we can refer to the following table. ... Here’s the month table. Columns 2 and 3 differs only for January and February. ... Now let’s go back to the algorithm.
Utexas
quasar.as.utexas.edu › BillInfo › doomsday.html
What is the day of the week?
This is really a nice trick. You can easily calculate the day of the week, given any date in history, and with a little practice you can even do it in your head. The method is based on one developed by John Horton Conway, and is described in Winning Ways, a book that he wrote with Berlekamp and Guy.
Art of Memory
artofmemory.com › blog › how-to-calculate-the-day-of-the-week
How to Calculate the Day of the Week from Any Date | Art of Memory
April 10, 2023 - The tool only calculates years from 1700 to 2399, but that should provide enough examples to teach you the algorithm. When the calendar switched from Julian to Gregorian, 11 days disappeared, so there are no dates between September 3, 1752 and September 13, 1752. ... Take ‘69 and divide by 4, discarding the remainder. That leaves 17. Add 69 to 17 to get 86. Then, 86 mod 7 = 2. The Year Code is 2. The Month Code for July is 6. The Century Code for the 1900s is zero. The Date Number is 20, because it’s the 20th of July.
Academia.edu
academia.edu › 31413474 › Algorithm_to_calculate_the_day_of_the_week
(PDF) Algorithm to calculate the day of the week
January 1, 2017 - The date, which identifies each day with three integers, year/month/day, gives no indication on the periods of the two calendars and on the day of the week, essential in some cases, for instance, whether it is a holiday or a working day. The following is an algorithm, easy to implement, which relates the calendar date with the day of the week and the periods of the Julian and Gregorian calendar, through two procedures: End-year method and March-first method.
Davecturner
davecturner.github.io › 2021 › 12 › 27 › doomsday-rule.html
The Doomsday rule: mental day-of-week calculations | David Turner says…
December 27, 2021 - The Doomsday rule is an algorithm for working out the day of the week of a given date. It’s based on John Conway’s observation that certain memorable dates called doomsdays (4/4, 6/6, 8/8, 10/10, 12/12, 9/5, 5/9, 7/11, 11/7, …) always occur on the same day of the week in any given year.