calendar
With this method you can work out in your head what day of the week any date was, or will be: the day you were born, July 4, 1776, or your birthday in 2040. It comes from a class handout by John D. Cook. It all comes down to adding five small numbers and keeping the remainder after dividing by 7.
Every step has exercises for each technique on its own, with random questions. Go in order until each one is automatic, and only then move on to all together.
notation
For a date m / d / Y (say 12 / 7 / 1941):
- Y = 1941 is the full year, c = ⌊Y/100⌋ = 19 is the century and y = Y mod 100 = 41 are the last two digits;
- m is the month and d the day of the month;
- D ∈ {0, 1, …, 6} is the day of the week you're after.
D ≡ y + ⌊y/4⌋ + M(m) + d − B + S(c) (mod 7)
A(y) = y + ⌊y/4⌋ is the year part, M(m) the month key, B the leap-year correction and S(c) the century correction. Each one has its own step below.
1. days as numbers
The week repeats every 7 days, so each day gets a D ∈ {0, …, 6}. In this method Sunday is 1 and the rest follow in order; Saturday would be 7, but 7 ≡ 0, so it's 0.
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 0 ≡ 7 |
On a wall calendar the week starts on Sunday: count from there on your fingers.
exercise 1 · D ↔ day
2. congruences mod 7
a ≡ b (mod 7) ⟺ 7 | (a − b)
read “a is congruent to b modulo 7”: a and b leave the same remainder when divided by 7.
n mod 7 = n − 7·⌊n/7⌋ ∈ {0, …, 6}
To get it, find the largest multiple of 7 that doesn't go over: 64 = 7·9 + 1 ⇒ 64 ≡ 1. It helps to know the multiples:
7 · 14 · 21 · 28 · 35 · 42 · 49 · 56 · 63 · 70 · 77 · 84 · 91 · 98 · 105 · 112 · 119 · 126
exercise 2a · n mod 7
negatives
If you end up with a negative number, add 7 until you land in {0, …, 6}: −1 + 7 = 6 ⇒ −1 ≡ 6, and −10 + 14 = 4 ⇒ −10 ≡ 4. That's why subtracting 1 is the same as adding 6.
exercise 2b · negatives
reduce before adding
Congruence plays well with addition and subtraction:
a ≡ a′ ∧ b ≡ b′ ⇒ a ± b ≡ a′ ± b′ (mod 7)
So you can swap any term for its remainder before adding, and you never handle big numbers: 29 + 23 + 18 ≡ 1 + 2 + 4 = 7 ≡ 0.
exercise 2c · reduce and add
3. the year: A(y)
A(y) = y + ⌊y/4⌋
Why? 365 = 7·52 + 1 ≡ 1 and 366 ≡ 2 (mod 7): every year the same date lands one weekday later, and two if a February 29 went by in between. From year 00 to year y, y years go by and ⌊y/4⌋ of them are leap years: the total shift is y + ⌊y/4⌋.
⌊y/4⌋
⌊x⌋ is the “floor” of x: the largest integer that doesn't go over x. You drop the decimals: ⌊41/4⌋ = ⌊10.25⌋ = 10. To get it, find the multiple of 4 that doesn't go over: 4·10 = 40 ≤ 41 < 44.
exercise 3a · ⌊y/4⌋
A(y) mod 7
Add and reduce: A(41) = 41 + 10 = 51 = 7·7 + 2 ≡ 2. Or reduce first, as in 2c: 41 ≡ 6 and 10 ≡ 3, so 6 + 3 = 9 ≡ 2. You can answer with the sum or the remainder: any number ≡ to the right one counts.
exercise 3b · A(y) mod 7
4. the month: M(m)
Each month has a fixed key:
| m | Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| M | 1 | 4 | 4 | 0 | 2 | 5 | 0 | 3 | 6 | 1 | 4 | 6 |
To memorize it, read it three at a time: 144 · 025 · 036 · 146, which are 12², 5², 6² and 12² + 2.
Where it comes from: each month starts shifted from the previous one by as many days as that month had, modulo 7:
M(m + 1) ≡ M(m) + (days in m)
Jan 31 ≡ 3 ⇒ M(Feb) = 1 + 3 = 4 · Feb 28 ≡ 0 ⇒ M(Mar) = 4 · Mar 31 ≡ 3 ⇒ M(Apr) ≡ 7 ≡ 0 · Apr 30 ≡ 2 ⇒ M(May) = 2 · and so on to December. If you ever forget a key, you can rebuild it.
exercise 4a · M(m)
month and day together
M(m) and d always go together, so it pays to practise them in pairs, reducing d first: (M(Dec) + 29) ≡ 6 + 1 = 7 ≡ 0.
exercise 4b · (M(m) + d) mod 7
5. leap years: L(Y) and B
a | b reads “a divides b”, and a ∤ b “doesn't divide it”. A year is a leap year (L = 1) if it's divisible by 4, except years ending in 00, which also have to be divisible by 400:
L(Y) = 1 ⟺ 4 | Y ∧ (100 ∤ Y ∨ 400 | Y)
So L(1964) = 1, L(1900) = 0 (100 | 1900 but 400 ∤ 1900) and L(2000) = 1.
exercise 5a · L(Y): 1 or 0
the correction B
B = 1 ⟺ L(Y) = 1 ∧ m ∈ {Jan, Feb}; otherwise B = 0
A(y) already counted that year's February 29, but January and February come before it, so it doesn't apply to them yet: you take it back with −B.
exercise 5b · B
6. the century: S(c)
The keys are tuned for the 1900s (S(19) = 0). For other centuries:
| c | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
|---|---|---|---|---|---|---|---|---|
| S | −1 | 4 | 2 | 0 | −1 | 4 | 2 | 0 |
The two rules that generate it (proved in the proof):
S(c − 1) ≡ S(c) + 2 − [4 | c] and S(c + 4) = S(c)
where [4 | c] is 1 if 4 divides c and 0 otherwise. A century shifts by 124 ≡ −2 days (plus 1 if its year 00 is a leap year), so going back one century adds 2: S(18) = 2, S(17) = 4, S(16) = 6 ≡ −1; except for 20 → 19, where it adds only 1 because 2000 is a leap year: S(19) = S(20) + 1 = 0. And 400 years are 146,097 = 7·20,871 days ≡ 0, so the table repeats. For dates around now S(19) = 0 and S(20) = −1 are enough.
exercise 6 · S(c)
7. all together
D ≡ A(y) + M(m) + d − B + S(c) (mod 7)
- A ≡ y + ⌊y/4⌋ (3a, 3b);
- M(m) from the table and d reduced (4a, 4b);
- B = 1 if L(Y) = 1 and it's January or February (5a, 5b);
- S(c) for the century (6);
- add, reduce mod 7 (2a–2c) and turn D into a day (1).
12/7/1941: D ≡ 41 + 10 + 6 + 7 − 0 + 0 = 64 = 7·9 + 1 ≡ 1 → Sunday
7/4/1776: D ≡ 76 + 19 + 0 + 4 − 0 + 4 = 103 = 7·14 + 5 ≡ 5 → Thursday
2/29/2024: D ≡ 24 + 6 + 4 + 29 − 1 − 1 = 61 = 7·8 + 5 ≡ 5 → Thursday
7/20/1969, reducing: A = 69 + 17 ≡ 6 + 3 = 9 ≡ 2; M = 0; d = 20 ≡ 6; B = 0; S = 0 ⇒ D ≡ 2 + 0 + 6 = 8 ≡ 1 → Sunday
with the pieces given
First practise just the assembly: you get A, M, d, B and S, and you add and reduce.
exercise 7a · D from the pieces
guided
A whole date, piece by piece: ⌊y/4⌋, A, M, d, B, S and finally D. Each answer stays noted above for the next one.
exercise 7b · step by step
straight through
Just the date, all in your head and against the clock. When you answer you see the whole sum. Start with the 1900s, where S = 0, and widen it later.
exercise 7c · date → day
years:
proof: where each piece comes from
Everything above comes from counting days. Definitions, for a date T = (Y, m, d) with Y = 100c + y:
- L(Y) ∈ {0, 1}: 1 if Y is a leap year (step 5);
- e(c) = L(100c) = [4 | c]: whether the century's year 00 is a leap year;
- W(c) ∈ {0, …, 6}: the weekday of January 1 of year 100c (the anchor);
- Δ(m): the days of a common year that went by before month m: 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334;
- N: the number of days between the anchor and T.
1. count the days
From the anchor to January 1 of Y there are y common years plus the February 29ths that fell in years 00, …, y − 1. Inside year Y you add Δ(m) + d − 1 days, and one more if its February 29 has already gone by (m ≥ 3 and L(Y) = 1). Counting the multiples of 4 from 1 to y, with year 00 on its own, all the February 29ths together are
⌊y/4⌋ + e(c) − B with B = L(Y) · [m ≤ 2]
(⌊y/4⌋ counts the leap years 04, 08, … up to y inclusive; if you're in January or February of one of them, its February 29 hasn't happened yet, hence the −B.) So:
N = 365y + ⌊y/4⌋ + e(c) − B + Δ(m) + d − 1
2. turn it into weekdays
Since a week has 7 days, D ≡ W(c) + N (mod 7), and 365 ≡ 1:
D ≡ y + ⌊y/4⌋ + [Δ(m) + 1] + d − B + [W(c) + e(c) − 2]
The two brackets are the method's constants:
M(m) ≡ Δ(m) + 1 and S(c) ≡ W(c) + e(c) − 2
For example, M(Feb) = 31 + 1 = 32 ≡ 4 and M(Dec) = 334 + 1 = 335 ≡ 6. That gives D ≡ y + ⌊y/4⌋ + M(m) + d − B + S(c).
3. the century constant
One real fact is needed: January 1, 1900 was a Monday, so W(19) = 2. Since e(19) = 0, S(19) = 2 + 0 − 2 = 0. For 2000, W(20) = 0 (Saturday) and e(20) = 1, so S(20) = 0 + 1 − 2 = −1.
For the other centuries: century c has 36,500 + 24 + e(c) days, and 36,524 = 7·5217 + 5 ≡ 5, so W(c + 1) ≡ W(c) + 5 + e(c). Substituting into the definition of S:
S(c + 1) ≡ S(c) − 2 + [4 | c + 1]
and from there S(c − 1) ≡ S(c) + 2 − [4 | c], the rule from step 6. Every 4 centuries there are 146,097 = 7·20,871 days, so S(c + 4) = S(c).
Check with 2000: 1/1/2000 → D ≡ 0 + 0 + 1 + 1 − 1 − 1 = 0 → Saturday, which is W(20).
where it comes from
The method is the one in John D. Cook's handout Determining days of the week, with the same month keys and Sunday as 1. He also explains it on his blog: Mentally calculating the day of the week. Dates use the Gregorian calendar, the one in use today.