Article — Date Difference Calculator
The date difference between two dates is the count of days from one to the other — and the answer depends on whether you include the end date, count weekdays only, or want the result in weeks, months, or years. Between January 1 and January 31 there are 30 days (interval) or 31 days (inclusive). Across a common year there are 365 days; across a leap year, 366. Business days drop those figures by roughly 28%, since weekends remove 2 of every 7 days. This calculator handles all of those at once, using the Julian Day Number algorithm so leap years and century rules never trip the count.
The math behind a date difference looks trivial — surely it is just subtraction? — but real-world day counting has caught out tax authorities, banks, contract lawyers, and even NASA. The variables that bite are leap years on the boundary, the off-by-one between “within” and “through” semantics, and the assumption that a month is a fixed length when it ranges from 28 to 31 days. Get any of those wrong and a 30-day notice can become 29 or 31; a quarterly interest accrual can shift by hundreds of dollars.
Date difference in plain numbers
The headline number is straightforward when both dates sit inside the same year. June 1 to August 1 is 61 days. The arithmetic is just summing month lengths: June (30) + July (31) = 61. When the range crosses a year boundary the count needs to know whether either year is a leap year, because February holds either 28 or 29 days. The difference between December 1, 2023 and December 1, 2024 is exactly 366 days, because 2024 is a leap year and February 29 sits inside the range.
Most date difference questions reduce to one of five forms. How many days between dates — calendar days, the default. How many business days — Monday through Friday only. How many weeks — total days divided by seven. How many months — total days divided by the Gregorian average of 30.4369 days per month. And how many years — total days divided by 365.25, the average year length over the 400-year Gregorian cycle. Each answer is derived from the same total-days figure.
October 4, 1582 was followed directly by October 15, 1582 in countries that adopted the Gregorian calendar reform. Ten calendar days simply vanished from history. The U.S. Naval Observatory and most date-difference tools handle this by using a proleptic Gregorian calendar — extending the Gregorian rules backwards as if they had always applied — which keeps the math consistent but does not match what people actually wrote in their diaries.
How the date difference calculation works
The cleanest way to find a date difference is the Julian Day Number method. Each Gregorian date converts to a continuous integer counting days since November 24, 4714 BC in the proleptic Gregorian calendar. Subtract two Julian Day Numbers and you get the day count directly — no month-length tables, no leap-year branching, no edge cases at year boundaries.
The Julian Day Number formula is a piece of late-19th-century cleverness. It packs the leap-year corrections (every 4, except every 100, except every 400) into three floor-divisions: Y/4 adds the leap year for every fourth year, Y/100 subtracts the century skip, and Y/400 adds back the 400-year override. The constants 32045 and 4800 anchor the count to the right epoch. The full formula appears in U.S. Naval Observatory tables and in NASA technical references for astronomical date conversion.
- 1 day — 86,400 seconds, the fundamental unit
- 1 week — 7 days, exact
- 1 month (average) — 30.4369 days, the Gregorian mean
- 1 common year — 365 days, three out of every four
- 1 leap year — 366 days, the fourth year (with exceptions)
- 1 Gregorian year (average) — 365.2425 days; 365.25 is the commonly used approximation
Date difference for business days
Business days strip weekends from the count: only Monday through Friday count. For a span of N calendar days, the business-day count is roughly N times five-sevenths, but the exact figure depends on which weekdays the range starts and ends on. A 14-day span starting on Monday hits two complete weeks of work plus the Monday and Friday of partial weeks — 10 business days. The same 14-day span starting on Saturday picks up 10 business days too, but starting on Sunday it picks up only 10 days as well; the boundary effects cancel within a full week.
Where it gets interesting is partial weeks. A 3-day range starting on Friday gives only 1 business day (Friday alone — Saturday and Sunday do not count). The same range starting on Wednesday gives 3 business days. This calculator iterates through the range day by day and checks each weekday rather than using a closed-form formula, so the count is always correct regardless of which day of the week the range starts.
U.S. federal holidays differ from UK bank holidays, German Feiertage, and Japanese 祝日 — even the dates that look the same (Christmas, New Year) often shift to the nearest weekday under different rules. This calculator counts Monday through Friday only. If you need a strict working-day figure for a specific jurisdiction, subtract the relevant holiday count by hand. The U.S. Office of Personnel Management lists federal holidays at opm.gov for U.S. calculations.
Leap years and the date difference
Leap years are the single biggest source of small errors in date-difference calculations done by hand. The rule is well known: a year divisible by 4 is a leap year. The two exceptions trip people up. A year divisible by 100 is not a leap year — unless it is also divisible by 400, in which case it is. So 1900 was not a leap year, but 2000 was. The next century-exception year is 2100, which will not be a leap year despite being divisible by 4.
The exact average year length in the Gregorian calendar is 365.2425 days — 365 + 97/400 — because there are 97 leap years in every 400-year cycle (100 years divisible by 4, minus 3 century exceptions, plus 1 added back for the 400-divisible exception). The simpler approximation of 365.25 used in most quick math is off by 0.0075 days per year, about 26 seconds — close enough for converting day spans to years but not for astronomical work.
The Julian calendar averaged 365.25 days per year exactly. The 0.0075-day annual overshoot meant the calendar drifted by about three days every 400 years — by 1582, the spring equinox had slipped from March 21 to March 11. The Gregorian reform restored the equinox to March 21 and prevented future drift by adding the century-exception rules. That is why the calendar reform skipped 10 days in October 1582.
Date difference in contracts and law
Contracts treat date differences in surprisingly varied ways. A “30-day notice” usually means 30 calendar days, but some jurisdictions require business days or working days, and some count from the day after notice is given (excluding the start date) while others count inclusively. The U.S. Federal Rules of Civil Procedure Rule 6 specifies that the start day is excluded and the last day is included, with the period extending to the next non-weekend non-holiday day if it falls on a weekend. UK and German civil procedure rules use similar but not identical conventions.
Bank interest accrual is another minefield. The U.S. mortgage convention typically uses actual/365 for interest calculations, while some European bond markets use 30/360, where every month is treated as exactly 30 days. A 30/360 month from January 31 to March 1 might count as 30 days, 31 days, or 28 days depending on the specific convention variant. Always confirm the day-count convention before estimating interest.
- Actual/365 — uses real calendar days, ignores leap; common in U.S. mortgages
- Actual/Actual — uses real days for both numerator and denominator; common in U.S. Treasuries
- 30/360 — treats every month as 30 days; common in European corporate bonds
- Working days — Mon–Fri minus public holidays; common in employment and contract law
- Business days — Mon–Fri without holiday adjustment; common in informal contracts
Common date difference pitfalls
The most common mistake is forgetting whether to count the start day, the end day, both, or neither. Hotel nights count interval only (check-in to check-out for 3 days is 2 nights). Sentence durations count inclusively in U.S. criminal law (a 30-day sentence served from June 1 is over on June 30, not July 1). Contract notice periods vary by jurisdiction. Always state the convention explicitly when communicating a duration.
A meeting at 11 PM New York time on December 31 is already January 1 in Berlin. If the start and end of a duration are recorded in different time zones, a date difference computed from the dates alone can be off by a day. For dates spanning international travel or international contract execution, anchor both timestamps to UTC or to a single reference zone before computing the difference.
February is 28 or 29 days; April, June, September, November are 30; the rest are 31. The Gregorian average is 30.4369 days. Approximating “3 months from January 31” as 90 days lands you on May 1, but the calendar date 3 months later is April 30 or May 1 depending on whether you preserve day-of-month or roll forward. Excel’s EDATE function and most calendar libraries return April 30 (preserving end-of-month).
Dates before October 15, 1582 in Catholic countries (and as late as 1918 in Russia) were recorded in the Julian calendar, which by 1900 was 13 days behind the Gregorian. This calculator uses proleptic Gregorian, treating dates before 1582 as if Gregorian rules always applied. For historical research, you may need to convert recorded Julian dates to Gregorian before computing the modern day count.