Skip to content
TheCalcUniverse

Day of Week

Find the day of the week for any date using Zeller's congruence. Features a perpetual calendar algorithm explanation and historical context.

✓ Tested formula & cited sources Formula verified 2026-01-15 Runs in your browser — inputs never sent anywhere

See it worked out

Example — Month 1, Day 1, Year 2024:

Day of the Week

Monday

Date

Monday, January 1, 2024

Month

1

Day

1

Year

2024

Zeller's Congruence

h = (q + ⌊13(m+1)/5⌋ + K + ⌊K/4⌋ + ⌊J/4⌋ − 2J) mod 7

Zeller Result (h)

2 → Monday

Formula Breakdown

q=1, m=13, K=23, J=20 → h = (1 + 36 + 23 + 5 + 5 − 40) mod 7 = 30 mod 7 = 2

First Day of Month

Monday

Days in Month

31

The formula

h = (q + ⌊13(m+1)/5⌋ + K + ⌊K/4⌋ + ⌊J/4⌋ − 2J) mod 7

h
Day of Week Index
q
Day of Month
m
Adjusted Month
K
Year of the Century
J
Century

Worked example — Month 1, Day 1, Year 2024

Day of the Week = Monday

Full explanation ↓

How Day of Week Works

h = (q + ⌊13(m+1)/5⌋ + K + ⌊K/4⌋ + ⌊J/4⌋ − 2J) mod 7

Zeller's Congruence is a mathematical formula that calculates the day of the week for any given date in the Gregorian calendar. It was developed by German mathematician Christian Zeller in the 1880s. The formula uses modular arithmetic and encodes month lengths, leap year rules, and century adjustments into a single expression. The floor function (⌊⌋) represents integer division (rounding down), which is essential for handling the irregular lengths of months and leap year patterns.

The modulo 7 operation produces a result in the range 0-6 that maps directly to days of the week.

h
Day of Week IndexThe calculated day of the week result (0=Saturday, 1=Sunday, 2=Monday, 3=Tuesday, 4=Wednesday, 5=Thursday, 6=Friday).
q
Day of MonthThe day of the month (1-31). For example, December 25 uses q = 25.
m
Adjusted MonthAdjusted month number: March=3, April=4, ..., December=12, January=13, February=14 of the previous year.
K
Year of the CenturyThe last two digits of the year (year mod 100). For 2024, K = 24.
J
CenturyThe zero-based century (year divided by 100, rounded down). For 2024, J = 20.
Zeller's Congruence computes the day of the week for any Gregorian calendar date using modular arithmetic.

How to Use

  1. Enter the month as a number (1-12), the day of the month (1-31), and the year as a positive integer.
  2. Click calculate to find the day of the week for that date, like "Wednesday" or "Friday."
  3. View the full day name, formatted date, and the complete Zeller's Congruence calculation broken down step by step.
  4. See the month calendar grid highlighting the position of the target date within the month.
  5. Check the "Days in Month" and "First Day of Month" for additional calendar context.

Understanding the Result

Zeller's Congruence is a mathematical formula devised by Christian Zeller in 1883 that computes the day of the week for any Gregorian calendar date. It cleverly encodes month lengths, leap year rules, and century adjustments into a single modular arithmetic expression. The reason January and February are treated as months 13 and 14 of the previous year is that this shift places the leap day (February 29) at the end of the calculation cycle, greatly simplifying how the formula handles leap years.

Without this adjustment, the formula would need an extra conditional term. The floor functions (represented by ⌊⌋) handle integer division, truncating fractional remainders. When working through the formula manually, each term represents a different calendar correction: the month term accounts for varying month lengths, the year terms account for leap years, and the century term accounts for the Gregorian calendar's century rule (years divisible by 100 are not leap years unless also divisible by 400).

Frequently Asked Questions

Why are January and February treated differently in Zeller's Congruence?
In Zeller's Congruence, January and February are counted as months 13 and 14 of the previous year. This shift places the leap day (February 29) at the very end of the calculation cycle rather than near the beginning. Because the formula's month term ⌊13(m+1)/5⌋ encodes month lengths, having the irregular February at the end simplifies the arithmetic significantly. Without this adjustment, the formula would need additional conditional logic for leap years.
Does Zeller's Congruence work for dates before the Gregorian calendar?
Zeller's Congruence works for any valid date in the Gregorian calendar, which was introduced in 1582 by Pope Gregory XIII. For dates before 1582 (Julian calendar dates), the formula may not produce accurate results. Additionally, different countries adopted the Gregorian calendar at different times — Britain and its colonies adopted it in 1752, Russia in 1918, and Greece in 1923 — so historical dates may be ambiguous.
What do the results h=0 through h=6 mean?
The result h is a number from 0 to 6 that maps to the day of the week: 0=Saturday, 1=Sunday, 2=Monday, 3=Tuesday, 4=Wednesday, 5=Thursday, 6=Friday. Note that the cycle starts on Saturday rather than Monday or Sunday because of the historical convention Zeller used. The calculator automatically converts this number to the familiar day name.
How is Zeller's Congruence different from the Doomsday algorithm?
Zeller's Congruence is a direct formula that computes the day of the week from the date components using modular arithmetic and floor functions. The Doomsday algorithm, developed by John Conway, uses a different approach based on memorizing certain "anchor" dates (like 4/4, 6/6, 8/8, etc. that always fall on the same day of the week in a given year). Zeller's is easier to program into a calculator, while Doomsday is more practical for mental calculation.
Can this calculator handle dates in the Julian calendar?
This implementation uses Zeller's Congruence for the Gregorian calendar (the calendar system used by most of the world today). For Julian calendar dates, a slightly modified version of the formula exists, but it produces different results for the same date. To verify historical dates, check which calendar system was in use in the relevant country at that time.
Was this calculator helpful?
Cite this calculator

TheCalcUniverse. "Day of the Week Calculator — Free Online Calculator & Formula Guide." TheCalcUniverse, 2026, https://thecalcuniverse.com/math/day-of-week-calculator/. Accessed July 27, 2026.

Embed this calculator on your site

Free to embed. Paste this into any HTML page — it stays up to date automatically.

Open embed ↗

You may also like