GoWin Tools
Tools
← Day of Week Calculator

Day of Week Calculator Β· 7 min read

How to Calculate the Day of the Week by Hand

Christian Zeller published his famous congruence formula in 1882. With a pencil and paper β€” or just mental arithmetic β€” you can determine the day of the week for any date in the Gregorian calendar. Here is exactly how.

Zeller's Congruence

Christian Zeller was a German mathematician who in 1882 published a formula for computing the day of the week for any date in the Julian or Gregorian calendars. His formula for the Gregorian calendar is:

h = (q + ⌊13(m+1)/5βŒ‹ + K + ⌊K/4βŒ‹ + ⌊J/4βŒ‹ βˆ’ 2J) mod 7

Where:

  • h is the day of the week (0 = Saturday, 1 = Sunday, 2 = Monday, 3 = Tuesday, 4 = Wednesday, 5 = Thursday, 6 = Friday)
  • q is the day of the month
  • m is the month (3 = March, 4 = April, ..., 14 = February β€” January and February are counted as months 13 and 14 of the previous year)
  • K is the year within the century (year mod 100)
  • J is the zero-based century (⌊year / 100βŒ‹)
  • ⌊xβŒ‹ means floor β€” round down to the nearest integer

The January/February rule is critical: those months are treated as months 13 and 14 of the preceding year. So January 15, 1900 is treated as month 13, year 1899.

Worked Example: July 4, 1776

Let's verify what day the Declaration of Independence was signed. The date is July 4, 1776.

Step 1: Identify the components.

  • Day: q = 4
  • Month: July = m = 7 (no adjustment needed β€” not January or February)
  • Year: 1776, so K = 76, J = 17

Step 2: Calculate each term.

  • q = 4
  • ⌊13(m+1)/5βŒ‹ = ⌊13 Γ— 8 / 5βŒ‹ = ⌊104/5βŒ‹ = ⌊20.8βŒ‹ = 20
  • K = 76
  • ⌊K/4βŒ‹ = ⌊76/4βŒ‹ = ⌊19βŒ‹ = 19
  • ⌊J/4βŒ‹ = ⌊17/4βŒ‹ = ⌊4.25βŒ‹ = 4
  • 2J = 2 Γ— 17 = 34

Step 3: Sum the terms.

h = (4 + 20 + 76 + 19 + 4 βˆ’ 34) mod 7
h = 89 mod 7
h = 89 βˆ’ (7 Γ— 12) = 89 βˆ’ 84 = 5

h = 5 corresponds to Thursday. July 4, 1776 was indeed a Thursday β€” the Declaration of Independence was adopted on a Thursday. (It was officially signed by most delegates on August 2, 1776 β€” also a Thursday, as it happens.)

The January/February Adjustment in Practice

Let's try February 14, 2000 (Valentine's Day, year 2000).

Because February is month 14 in Zeller's system, we shift the year back by one: we use year 1999 instead of 2000.

  • q = 14
  • m = 14 (February)
  • Year = 1999, so K = 99, J = 19

Calculate:

  • ⌊13(14+1)/5βŒ‹ = ⌊13 Γ— 15 / 5βŒ‹ = ⌊195/5βŒ‹ = ⌊39βŒ‹ = 39
  • ⌊K/4βŒ‹ = ⌊99/4βŒ‹ = ⌊24.75βŒ‹ = 24
  • ⌊J/4βŒ‹ = ⌊19/4βŒ‹ = ⌊4.75βŒ‹ = 4
  • 2J = 38
h = (14 + 39 + 99 + 24 + 4 βˆ’ 38) mod 7
h = 142 mod 7
h = 142 βˆ’ (7 Γ— 20) = 142 βˆ’ 140 = 2

h = 2 corresponds to Monday. February 14, 2000 was indeed a Monday.

Month Code Table

The ⌊13(m+1)/5βŒ‹ term is the heart of the formula β€” it accounts for the varying lengths of months. Here is what it evaluates to for each month, which you can memorize to speed up mental calculation:

MonthZeller m⌊13(m+1)/5βŒ‹
March310
April413
May515
June618
July720
August823
September926
October1028
November1131
December1233
January (prev yr)1336
February (prev yr)1439

Day Code Output Table

h valueDay of Week
0Saturday
1Sunday
2Monday
3Tuesday
4Wednesday
5Thursday
6Friday

Handling Negative Results

The formula can produce a negative number before the mod operation, particularly for dates in the 1800s and earlier (because βˆ’2J can become a large negative number). In modular arithmetic, βˆ’1 mod 7 = 6, not βˆ’1. The safe approach: if your sum before mod 7 is negative, add a multiple of 7 large enough to make it positive before dividing.

For example, if your sum before mod is βˆ’5: βˆ’5 + 7 = 2. h = 2 β†’ Monday.

Julian Calendar Variant

Zeller also published a version for the Julian calendar (used before October 1582 in most of Europe). The Julian variant replaces the βˆ’2J term with +5 βˆ’ J. The January/February treatment remains the same. For dates before October 15, 1582 in Western Europe, use the Julian variant.

If you would rather not do the arithmetic yourself: try the Day of Week Calculator β†’

References

  1. Zeller, C. (1882). Kalender-Formeln. Acta Mathematica, 9, 131–136.
  2. Dershowitz, N., & Reingold, E. M. (2008). Calendrical Calculations (3rd ed.). Cambridge University Press.
  3. Richards, E. G. (1998). Mapping Time: The Calendar and its History. Oxford University Press.