Time & Calendar
Intermediate

Day of the Week from a Birthdate

Gauss's weekday formula — find which day of the week any birthdate fell on.

Formula

W=(d+⌊2.6m−0.2⌋+y+⌊y4⌋+⌊c4⌋−2c) mod 7W = \left(d + \left\lfloor 2.6m - 0.2 \right\rfloor + y + \left\lfloor\tfrac{y}{4}\right\rfloor + \left\lfloor\tfrac{c}{4}\right\rfloor - 2c\right) \bmod 7

Variables

dDay of month
mMonth (Mar=1 … Dec=10, Jan=11, Feb=12 of prior year)
yYear within century
cCentury
W0=Sun,1=Mon,…,6=Sat

Example

15 Aug 1947 → W = 5 ⇒ Friday

How it works

This is a compact version of Gauss’s weekday calculation: it turns a date into a number from 0 to 6 that matches Sunday through Saturday. The idea is to add up the day of the month, the month’s offset within the year, and the leap-year contributions from the year and century, then reduce the total modulo 7 because weekdays repeat every 7 days. The special month numbering starts the year in March so that February can be treated as the last month of the previous year, which makes leap years fit cleanly into the arithmetic.

When to use it

Use this when you need the day of the week for a historical date, birthdate, or anniversary without a calendar lookup. It is especially useful in maths puzzles, date calculations, and quick checks in history or genealogy work.

Worked example, step by step

Find the weekday for 2 July 1990. Here, d = 2, m = 5 (because March=1, April=2, May=3, June=4, July=5), y = 90, c = 19. Compute the month term: floor(2.6m - 0.2) = floor(2.6 × 5 - 0.2) = floor(12.8) = 12. Compute the year terms: floor(y/4) = floor(90/4) = 22 and floor(c/4) = floor(19/4) = 4. Substitute into the formula: W = (2 + 12 + 90 + 22 + 4 - 2×19) mod 7. Simplify: W = (2 + 12 + 90 + 22 + 4 - 38) mod 7 = 92 mod 7. 92 ÷ 7 leaves remainder 1, so W = 1. Since 1 = Monday, 2 July 1990 was a Monday.

Common mistakes to avoid

  • Forgetting to shift January and February into the previous year and using the wrong month number
  • Mixing up the weekday codes, especially assuming 0 means Monday instead of Sunday
  • Using the full year 1990 in the y term instead of only the year within the century, 90

Did You Know?

Isaac Asimov reportedly could name the weekday of any date in his head; the trick is exactly this kind of modular arithmetic.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026