Calendar Calculator

A calendar calculator for the Gregorian calendar.

Everyday Zeller’s congruence ISO 8601 weeks Julian day numbers
Rate this calculator

Day of week, days between dates, and calendar facts

Day of week · ISO week · day of year · leap year · Julian day number

Instructions — Calendar Calculator

1

Pick what you want to calculate

Choose Day of week for a single date, Days between dates to count the gap, or Date facts to see week number, day of year, leap-year status, and Julian day number for one date.

2

Enter your date (or two)

Type or pick a date with the calendar input. The calculator accepts any Gregorian date from 4713 BCE to 9999 CE. Historical dates before 15 October 1582 are computed using the proleptic Gregorian calendar.

3

Read the result

The headline shows the primary answer. The grid below carries the extra facts: ISO week, day of year, leap year, JDN, weeks-and-days breakdown for date differences.

ISO week vs calendar week: the ISO 8601 week-numbering year can differ from the calendar year. Late December 2024 dates fall in week 1 of 2025 if their Thursday lands in 2025.
Reversed dates are fine: if your end date is earlier than your start date the calculator returns the absolute difference and shows a notice — direction does not change the count.

Formulas

Three classical formulas drive every answer: Zeller’s congruence for day of week, the Gregorian leap-year rule, and the Julian Day Number for date arithmetic.

ZELLER’S CONGRUENCE (DAY OF WEEK)
$$ h = \left( q + \left\lfloor \tfrac{13(m+1)}{5} \right\rfloor + K + \left\lfloor \tfrac{K}{4} \right\rfloor + \left\lfloor \tfrac{J}{4} \right\rfloor - 2J \right) \bmod 7 $$
q = day, m = month (January and February counted as 13 and 14 of the previous year), K = year mod 100, J = year ÷ 100. h = 0 maps to Saturday, 1 to Sunday, … 6 to Friday.
GREGORIAN LEAP YEAR
$$ \text{leap}(y) = (y \equiv 0 \bmod 400) \;\lor\; (y \equiv 0 \bmod 4 \;\land\; y \not\equiv 0 \bmod 100) $$
2000 was leap (divisible by 400). 1900 was not (divisible by 100 but not 400). 2024 is leap. Adds February 29 — total 366 days.
JULIAN DAY NUMBER (JDN)
$$ \text{JDN} = d + \left\lfloor \tfrac{153m' + 2}{5} \right\rfloor + 365y' + \left\lfloor \tfrac{y'}{4} \right\rfloor - \left\lfloor \tfrac{y'}{100} \right\rfloor + \left\lfloor \tfrac{y'}{400} \right\rfloor - 32045 $$
Fliegel & Van Flandern formula. y' and m' are the year and month adjusted so March is month 1. Output is a continuous integer count of days from the JDN epoch (1 January 4713 BCE Julian).
DAYS BETWEEN TWO DATES
$$ \Delta = | \text{JDN}_2 - \text{JDN}_1 | $$
Converting both dates to JDN turns date arithmetic into integer subtraction. Sidesteps leap-year and month-length edge cases that trip up naive day-of-year subtraction.

Reference

Days in each month
MonthCommon yearLeap year
January3131
February2829
March3131
April3030
May3131
June3030
July3131
August3131
September3030
October3131
November3030
December3131
Leap years 1900–2100
YearLeap?Reason
1900No÷100, not ÷400
2000Yes÷400
2020Yes÷4
2024Yes÷4
2025Nonot ÷4
2028Yes÷4
2100No÷100, not ÷400
Quick reference: notable Julian day numbers
DateJDNEvent
1 Jan 4713 BCE (Julian)0JDN epoch
15 Oct 15822,299,161Gregorian calendar introduced
1 Jan 19002,415,021Excel epoch (in 1900 mode)
1 Jan 19702,440,588Unix epoch
1 Jan 20002,451,545J2000.0 astronomical epoch (noon)
1 Jan 20262,460,677Reference for current year arithmetic

Article — Calendar Calculator

A calendar calculator answers the everyday date questions that arithmetic alone struggles with: which day of the week was 4 July 1776, how many days separate two project milestones, when does the ISO week roll over, and is the current year a leap year? The maths is exact when you use the right tools — Zeller’s congruence for day of week, the Gregorian leap-year rule for February, and the Julian day number for clean date subtraction. This calculator chains those three ideas so you can move between dates without counting on fingers.

Below is a walk-through of each calculation: how it works, where the formulas come from, the edge cases that trip up spreadsheets, and the historical reasons the modern calendar looks the way it does.

Finding the day of the week for any date

The most efficient way to compute the day of the week without a lookup table is Zeller’s congruence, published by Christian Zeller in 1882. The formula treats January and February as months 13 and 14 of the preceding year, then combines the day, month, year-of-century, and century into a single modular sum. The remainder when divided by 7 maps directly to a weekday: 0 for Saturday, 1 for Sunday, on up to 6 for Friday.

The result is exact for every date in the proleptic Gregorian calendar — that is, the Gregorian system extended backwards before its actual 1582 introduction. So 4 July 1776 returns Thursday, 1 September 1939 returns Friday, and 6 June 1944 returns Tuesday. The calculator uses Zeller’s congruence directly, which is why an arbitrary date from 9999 CE or 2000 BCE answers instantly without scanning a table.

Did you know

The day of the week for any given date in the Gregorian calendar repeats on a perfect 400-year cycle. The cycle contains exactly 146,097 days (400 × 365 + 97 leap days), which is divisible by 7 with no remainder. So 14 February 2026 falls on the same weekday as 14 February 1626 and will on 14 February 2426.

Counting days between two calendar dates

Subtracting two calendar dates naively — by counting days through each month and adjusting for leap years — is where most spreadsheet bugs hide. The cleaner approach is to convert each date to a Julian day number (JDN), a continuous integer count of days since the JDN epoch, and subtract. Month lengths and leap-year rules are absorbed into the JDN conversion, leaving plain integer subtraction at the end.

For the span from 1 January 2024 to 31 December 2024 the JDNs are 2,460,311 and 2,460,677; the difference is 366 days because 2024 is a leap year. The same approach handles negative spans (where the second date precedes the first) by taking the absolute value, and it works across century boundaries without special cases. The U.S. Naval Observatory, the International Astronomical Union, and astronomical software libraries like NOVAS all use JDN-based arithmetic for the same reason.

  • 365 days — a common year, length of January 1 to December 31 in non-leap years
  • 366 days — a leap year (2000, 2004, 2008, 2012, 2016, 2020, 2024, 2028)
  • 146,097 days — one complete 400-year Gregorian cycle
  • 52 weeks and 1 day — what a common year actually measures
  • 52 weeks and 2 days — a leap year
  • 10 days — gap skipped in October 1582 when the Gregorian calendar was introduced

The Gregorian leap-year rule

The leap-year rule is three lines long but its precision drives the calendar. A year is a leap year if it is divisible by 4, except if it is divisible by 100, except if it is divisible by 400. The exceptions matter: 1900 was not a leap year (÷100, not ÷400), but 2000 was (÷400). The reform was about correcting the Julian calendar’s 11-minute-per-year drift against the solar year.

The Gregorian year averages 365.2425 days, almost exactly the 365.24219-day tropical year measured by modern astronomy. The Julian calendar averaged 365.25 days — close, but a day off every 128 years. By 1582 the Julian calendar had drifted ten days from the true solar position, prompting Pope Gregory XIII to introduce the new rule and drop the accumulated error by skipping 5–14 October 1582 entirely in Catholic countries.

Excel handles 1900 wrong

Microsoft Excel treats 29 February 1900 as a valid date for backwards compatibility with Lotus 1-2-3, which had the same bug. 1900 was not a leap year. Date arithmetic in Excel for spans crossing 1 March 1900 is therefore off by one day. Most production calendar systems (Unix time, JavaScript Date, PostgreSQL date) use the correct Gregorian rule.

ISO 8601 week numbers in calendar math

The ISO 8601 standard defines weeks as Monday-to-Sunday and assigns week 1 to the week containing the first Thursday of the year. The consequence: a year can have either 52 or 53 ISO weeks, and the ISO week-numbering year can disagree with the calendar year at the boundaries. 31 December 2024 falls in ISO week 1 of 2025, because its Thursday (2 January 2025) lands in 2025.

The ISO week format is used widely in European business systems, project planning software, and supply-chain dating. The calculator computes it by finding the Thursday of the week that contains the input date, locating that Thursday’s ISO year, and counting weeks from the first Thursday of that ISO year. Output uses the standard YYYY-Www format (for example 2026-W23).

Did you know

The ISO week year takes its name from the year containing the majority of the week’s days — specifically the year of the Thursday. That means the first three days of January (1–3 January) can belong to the previous year’s last ISO week, and the last three days of December can belong to next year’s week 1. A 53-week year occurs when 1 January falls on a Thursday, or on a Wednesday in a leap year.

The Julian day number and date arithmetic

The Julian day number system was introduced by Joseph Scaliger in 1583. The epoch — JDN 0 — is noon on 1 January 4713 BCE in the proleptic Julian calendar. Scaliger picked it because it was the most recent date where three traditional cycles (the 28-year solar cycle, the 19-year Metonic lunar cycle, and the 15-year Roman indiction) all began at the same time. The choice put the epoch safely before any recorded historical event.

The practical value is that the JDN turns every date into a single integer. Astronomers, satellite operators, and database designers use it for exactly the same reason the calculator does: subtracting two integers is simpler than reasoning about months and leap years. The Fliegel and Van Flandern formula (1968) used here converts a Gregorian date to JDN in seven integer operations and handles every Gregorian date from 1 March −4800 onward.

Year zero does not exist in the historical calendar

The proleptic Gregorian calendar used here includes a year zero between 1 BCE and 1 CE. Historical calendars do not: the year after 1 BCE is 1 CE with no zero between them. If you are calculating spans across the BCE/CE boundary for historical attribution, subtract one extra year from BCE dates to align with the historical count.

Calendar history, gaps, and common traps

The Gregorian calendar was adopted unevenly across the world. Catholic Europe switched in October 1582; Protestant Britain and its American colonies waited until 1752, skipping 11 days; Russia adopted it only in 1918, dropping 13 days; Greece followed in 1923 with 13 days skipped. So a date written in a 1700 letter from London (Julian) and a 1700 letter from Paris (Gregorian) refer to different days, even if the calendar numbers match.

Other quirks to watch: countries with different week-start conventions (Monday in ISO and most of Europe, Sunday in the U.S. and parts of the Middle East), daylight-saving time changes that shift clock readings without changing the calendar date, and the rare leap second occasionally inserted at the end of June or December to keep UTC aligned with Earth’s rotation. None of those affect the day-of-week or days-between numbers this calculator returns — they all sit at the calendar-date layer above clock time.

Dates before 15 October 1582 need care

The calculator handles pre-1582 dates as proleptic Gregorian — extending the modern rule backwards. That is fine for arithmetic but wrong for historical attribution. Battle of Hastings (14 October 1066 Julian) is the standard reference; the same event on the proleptic Gregorian calendar would be 20 October 1066. When citing historical dates, label the calendar (Old Style / New Style is the conventional shorthand for Julian / Gregorian).

FAQ

The standard formula is Zeller’s congruence: h = (q + ⌊13(m+1)/5⌋ + K + ⌊K/4⌋ + ⌊J/4⌋ − 2J) mod 7. q is the day of month, m is the month (with January and February treated as months 13 and 14 of the previous year), K is the year mod 100, and J is the century (year ÷ 100). The result h maps 0 to Saturday, 1 to Sunday, up to 6 to Friday. This calculator runs the formula on every date you enter.
A year is a leap year in the Gregorian calendar if it is divisible by 4, except years divisible by 100 are not leap years, unless they are also divisible by 400. So 2000 was a leap year (÷400), 1900 was not (÷100 but not ÷400), and 2024 is one (÷4). The average Gregorian year is 365.2425 days, very close to the 365.24219-day tropical year.
Convert both dates to Julian day numbers (JDN) and subtract. JDN is a continuous integer count of days, so subtraction handles month lengths and leap years automatically. For example, from 1 January 2024 to 31 December 2024 the JDNs are 2,460,311 and 2,460,676, giving 366 days because 2024 is a leap year.
The Julian day number (JDN) is the count of days since noon on 1 January 4713 BCE in the proleptic Julian calendar. Joseph Scaliger picked that epoch in 1583 because three traditional cycles all began on that date. Astronomers and database systems use JDN for date arithmetic because subtracting two integers is simpler than reasoning about months and leap years.
ISO 8601 defines a week as Monday through Sunday and assigns week 1 to the week containing the first Thursday of the calendar year. The format is YYYY-Www (for example 2026-W23). The ISO week-numbering year can differ from the calendar year for dates close to 1 January or 31 December — late December dates can fall in week 1 of the next year if their Thursday lands in that year.
Yes, but interpret with care. The calculator uses the proleptic Gregorian calendar (the modern rule extended backwards). For dates before 15 October 1582, that gives a mathematically consistent answer but differs from the historical Julian date by several days — about 10 days in 1582, fewer further back. The Battle of Hastings on 14 October 1066 Julian is 20 October 1066 in the proleptic Gregorian calendar.
When Pope Gregory XIII introduced the Gregorian calendar in 1582, the Julian calendar had drifted 10 days from the true solar year. To correct this, Catholic countries skipped 5 October through 14 October 1582 — Thursday 4 October was followed directly by Friday 15 October. Other countries adopted the new calendar later and skipped a different range of days. Britain and its American colonies skipped 11 days in September 1752.
The tropical year — the time the Earth takes to complete a seasonal cycle — is about 365.24219 days. The Gregorian calendar approximates this with an average year of 365.2425 days, leaving an error of about 26 seconds per year. After roughly 3,300 years the calendar will drift one day from the solar position, at which point a further correction may be needed.
No. Daylight saving time shifts the clock by one hour but does not change the calendar date — the day starts and ends at midnight regardless of DST. The only effect on this calculator is if you enter a date around the DST switch using a system clock that shifted, the date value itself is unchanged.
The calculator computes the absolute difference, so the answer is the same number of days either way. It also displays a notice that the dates are reversed, in case direction matters for your use case (interest calculation, project deadline, age). If you need a signed difference, subtract the dates yourself: JDN(end) − JDN(start) gives a negative value when end precedes start.