Core answer: Any date's weekday can be computed by anchoring a known day and counting mod 7. Known anchors: 2000-01-01 was a Saturday; 2024-01-01 was a Monday; 2025-01-01 is a Wednesday. Each normal year shifts the same date +1 weekday, each leap year +2 (because 365 = 52×7 + 1, and 366 adds 2).
The anchor-and-shift method
- Pick a known anchor (e.g., 2025-01-01 = Wednesday).
- Count days between anchor and target (same year: sum month lengths; across years: +365 per year, +1 extra per leap day passed).
- Total mod 7 = weekday offset.
Example — 2025 National Day (Oct 1). Days from Jan 1 to Oct 1: 31+28+31+30+31+30+31+31+30 = 273. 273 mod 7 = 0 → Oct 1 is also Wednesday. (2025-10-01 is indeed a Wednesday.)
Zeller's congruence (the classic formula)
For the Gregorian calendar, with March = month 3 ... January/February counted as months 13/14 of the PREVIOUS year:
h = (q + ⌊13(m+1)/5⌋ + K + ⌊K/4⌋ + ⌊J/4⌋ + 5J) mod 7
where q = day, K = year mod 100, J = year div 100; h = 0 means Saturday, 1 = Sunday … 6 = Friday. It looks scary but runs in a line of code — every "what day was I born" tool uses this or its equivalent.
The doomsday algorithm (mental math in 10 seconds)
John Conway's trick: memorize one "doomsday" per year — the weekday shared by 4/4, 6/6, 8/8, 10/10, 12/12, and 5/9, 9/5, 7/11, 11/7, and the last day of February. For 2025 the doomsday is Friday: so 2025-08-08 is Friday, 2025-12-12 is Friday, and 2025-10-01 = (10/10 Friday − 9 days) = Wednesday ✓.
Doomsdays by year: 2024 Thursday, 2025 Friday, 2026 Saturday, 2027 Sunday, 2028 Tuesday (leap shift).
Worked examples
Example 1 — Planning. You want 2026-05-01 (Labor Day) for an event: 2026-01-01 is Thursday (2025 Wed + 1). Days to May 1: 31+28+31+30 = 120; 120 mod 7 = 1 → Thursday + 1 = Friday — a natural long-weekend start.
Example 2 — Birthday check. Born 1990-06-15? Anchor 2000-01-01 Saturday, go back: 1990→2000 spans 10 years with leap days in 1992, 1996, 2000 (before June? 2000's Feb 29 counts when crossing backward past it) → 365×10 + 3 = 3,653 days; 3,653 mod 7 = 6 → 1990-01-01 = Saturday − 6 = Monday. Days Jan 1 → Jun 15: 31+28+31+30+31+14 = 165; 165 mod 7 = 4 → Monday + 4 = Friday. Correct: 1990-06-15 was a Friday.
Common mistakes and myths
- Off-by-one on inclusive counts — "10 days from today" excludes today; weekday math needs exclusive start, inclusive end (or vice versa), never both.
- Forgetting leap-year boundaries — the +2 shift applies only when Feb 29 falls BETWEEN your two dates; January dates in a leap year still shift +1.
- Assuming 400-year repetition isn't exact — the Gregorian cycle is exactly 400 years (146,097 days = 20,871 weeks); 2025's calendar repeats exactly in 2425.
- Century leap trap — 1900 was NOT a leap year, 2000 was; divisible-by-100 years need divisibility by 400.
- Believing the 13th fears — the 13th falls on a Friday slightly MORE often than other weekdays (688/4800 months) — a curiosity of the 400-year cycle, not superstition.