How a computer works out the weekday for any date
Every date since the Gregorian calendar took effect has exactly one correct weekday, and it can be worked out with arithmetic alone — no calendar app or lookup table required. The underlying idea is the same one formalized by Zeller's congruence and Sakamoto's method: count the total number of days from a known reference point, then take that count modulo 7 to land on a weekday.
Modern software doesn't run the classic Zeller formula literally — it typically tracks day counts using a proleptic Gregorian calendar internally — but the result is mathematically identical to what those pen-and-paper algorithms compute. That consistency is exactly why this calculator, a paper almanac, and a mental-math trick all agree on the same answer for the same date.
The one-day (or two-day) shift, year over year
A regular year runs 365 days — exactly 52 weeks plus one extra day. That leftover day is why a fixed date, say July 4, moves forward exactly one weekday each year: Tuesday one year, Wednesday the next, and so on.
Leap years break that steady pattern. Because February 29 gets inserted partway through the year, any date from March 1 onward jumps forward two weekdays instead of one, compared to the year before. Dates in January and February aren't affected until the leap day has actually passed.
There's a further wrinkle at the century mark: years divisible by 100 are not leap years unless they're also divisible by 400. The year 2000 was a leap year under that rule; 1900 was not, and 2100 won't be either — a detail that matters if you're calculating weekdays far into the past or future.
Checking weekdays for historical dates
Because the weekday is a fixed property of the date itself, this same calculation works for verifying historical records — confirming a documented event actually happened on the weekday a source claims, or working out what day of the week a distant ancestor was born on.
One caveat for dates before 1582: the calendar in use before the Gregorian reform (the Julian calendar) ran on slightly different leap-year rules, so weekday calculations for dates prior to that switch depend on which calendar the historical record itself was using.
Beyond a single date: occurrences and weekday counts
Once you can compute a weekday for one date, three more useful questions fall out of the same math:
- Next/previous occurrence — the closest date before or after a given day that falls on a specific weekday, useful for finding "the next Friday" from any starting point.
- Count weekdays — how many times a given weekday (say, Monday) occurs inside a date range, which is the same math behind counting pay periods or recurring meeting dates.
- Find all occurrences — a full list of every date a specific weekday falls on within a range, handy for scheduling anything that repeats weekly.
If what you need instead is the exact number of days between two dates, or a running countdown to a target date, the Day Counter handles that directly. For adding or subtracting years, months, or weeks from a date, see the Date Calculator.