Date Difference Calculator
Free date difference calculator. Find the exact days, weeks, months, years, hours, and business days between any two dates — Gregorian calendar accurate.
Date Difference Calculator
Background.
This date difference calculator measures the exact distance between any two calendar dates and returns that distance in every unit a human or a project plan actually needs: total days, total weeks, total hours, total minutes, business days (Monday through Friday), and a Gregorian-calendar-walking decomposition into whole years, months, and days. The arithmetic is anchored to UTC midnight so that local daylight-saving transitions cannot inject or remove a phantom hour at the boundary, and the calendar walk is the real Gregorian rule — every four years a leap day, except century years, except century years divisible by 400 — not a lazy division by 365.25 that drifts by roughly a day every 130 years.
The distinction between calendar duration and raw day counting matters more than people expect. Two dates that are 'one year, two months, and three days' apart are not the same length depending on which year and which months they span: a February-bounded interval has 28 or 29 days, an April-to-May interval has 30, and a December-to-January interval crosses a year boundary that no decimal can express cleanly. That is why every serious date library — Howard Hinnant's chrono proposal that became part of C++20, Python's dateutil.relativedelta, JavaScript's emerging Temporal API, Java's java.time package authored by Stephen Colebourne after JSR-310 — walks the calendar one month at a time rather than treating dates as offsets in a flat seconds-since-epoch number line.
Business-day counting matters for a different audience entirely: project managers, lawyers computing statute-of-limitations windows, courts counting filing deadlines, payroll systems computing pay-period accruals, logistics teams quoting shipping ETAs, and finance teams settling trades on T+2. The Monday-through-Friday convention this calculator uses is the lowest-common-denominator definition; it deliberately ignores public holidays because they vary by country (the United States has 11 federal holidays, the United Kingdom has 8 bank holidays in England and Wales but more in Scotland and Northern Ireland, Kenya has 12 gazetted public holidays, Japan has 16) and even within a country by industry. A bank in New York closes on Columbus Day; a tech company in San Francisco does not. The right pattern is to use this calculator for the weekday-count baseline and subtract your own holiday count separately.
The inclusive-versus-exclusive end-date question is the other recurring source of off-by-one bugs in date arithmetic. The convention this calculator follows by default is the half-open interval [start, end), the same convention every database, every iterator, and every senior software engineer has settled on after decades of off-by-one errors. The end date is excluded; an interval from Monday to Friday is four days, not five, because you spent four nights and woke up on five mornings. The 'include end date' toggle switches to the closed interval [start, end] for use cases where the end date itself counts — hotel reservations counted as nights, contract durations counted from the first day to the last day inclusive, a holiday spanning Christmas Day through New Year's Day inclusive, or any context where the end is a date you possess rather than a boundary you cross.
Below the widget you will find a worked example, a tour of the Gregorian calendar's leap-year quirks (the year 2000 was a leap year because it is divisible by 400; the year 1900 was not because it is a non-400 century year — a subtlety that breaks roughly 30 percent of hand-rolled date routines), guidance on time-zone handling (short answer: pin everything to UTC at the data layer and let the display layer localise), and a discussion of why business-day counting needs to be country-aware once you cross the public-holiday boundary.
What is date difference calculator?
A date difference calculator computes the elapsed time between two calendar dates and expresses that elapsed time in multiple units simultaneously: aggregate units such as total days, total weeks, total hours, and total minutes, plus a human-readable decomposition into whole years, whole months, and whole days. The two views answer different questions. The aggregate view answers 'how many days passed' (one number, unambiguous, suitable for billing and analytics). The decomposed view answers 'how long is this interval in the units a human would say out loud' — 'one year, two months, and three days' — which is more meaningful for milestones, project plans, and contracts. The two views are not interchangeable. An interval of 'one year, two months, and three days' is not a fixed number of total days; it depends on which calendar months the interval traverses. A January-to-April span includes a 28- or 29-day February, while an April-to-July span includes 30-day months only. Calendar-walking arithmetic respects that; flat day division does not. The inclusive-versus-exclusive end-date convention is the other axis of flexibility. The default is the half-open interval [start, end) — the end date is the boundary you cross, not a day you spent. This matches the convention used by every modern database, every programming language's standard library, and every project-management tool. Switching the toggle to inclusive gives you the closed interval [start, end], which is the convention humans use when they count something like 'I am on vacation from Monday to Friday' — meaning all five weekdays, not four. The calculator stores all dates as ISO 8601 strings (YYYY-MM-DD), the unambiguous machine-readable standard that avoids the long-running transatlantic confusion between MM/DD/YYYY (United States) and DD/MM/YYYY (rest of the English-speaking world). All arithmetic happens at UTC midnight to immunise the result from daylight-saving-time transitions that would otherwise corrupt day counts at the spring-forward and fall-back boundaries by an hour each year.
How to use this calculator.
- Enter the earlier of the two dates in the 'Start date' field, formatted as ISO 8601 (YYYY-MM-DD). For example, 2020-03-15 means March 15, 2020.
- Enter the later of the two dates in the 'End date' field, same format. The calculator rejects reversed ranges where the end date is before the start date — swap the inputs or correct the typo if you see that error.
- Choose the inclusive or exclusive convention. Leave it on 'No' (the default) for standard half-open counting, which is what every database, programming library, and project-management tool uses. Switch to 'Yes' when both endpoints count as part of the interval — hotel nights, contract durations, vacation days where you count the first and last day.
- Read the primary 'Total days' result for the most common search query — 'how many days between X and Y'. That figure includes every leap day in the interval automatically.
- Use the 'Years / Months / Days' decomposition for the human-readable answer you would say in conversation. The calendar walk handles month-end edge cases (January 31 + one month = February 28 or 29, not March 3) correctly.
- Use 'Total hours' and 'Total minutes' for SLA computations, billing reconciliation, and timesheet math where smaller units matter.
- Use 'Business days' for project planning, court-filing deadlines, payroll periods, and trade settlement windows. Remember to subtract your country's public holidays separately — this figure counts Monday through Friday only and is intentionally country-neutral.
The formula.
The calculator runs three independent computations and reports them side by side.
1. Aggregate day count (totalDays). Both dates are parsed as UTC-midnight Date objects and the difference is taken in milliseconds, then divided by 86,400,000 (the number of milliseconds in a 24-hour day). The UTC anchoring is the critical detail: if you computed the delta in local time, a daylight-saving transition would inject an extra hour (in the fall) or remove one (in the spring), and an interval that is exactly N days in real terms could round to N±1. From totalDays the calculator derives totalWeeks = totalDays / 7 (rounded to two decimal places), totalHours = totalDays × 24, and totalMinutes = totalDays × 1440.
2. Gregorian decomposition (years / months / days). The calculator walks the calendar forward from the start date one calendar unit at a time. First, whole years: refYear − startYear, minus one if (refMonth, refDay) is before (startMonth, startDay). Then it advances an anchor by that many years and counts whole calendar months from that anchor to the end date, again with a month-boundary check to subtract one if the day-of-month has not yet been reached. Finally it computes the day difference from the (years + months) anchor to the end date. This decomposition respects the actual length of each calendar month (28, 29, 30, or 31 days depending on the month and year) rather than approximating months as 30.4 days or years as 365.25 days. The Gregorian leap-year rule the walk encodes is: every year divisible by 4 is a leap year, EXCEPT century years (divisible by 100) are NOT, UNLESS they are also divisible by 400. That rule produces an average year length of exactly 365.2425 days — within 27 seconds of the actual mean tropical year (365.24219 days) and the reason a hand-rolled 365.25-day routine drifts by about three days every 400 years.
3. Business-day count. The calculator iterates day-by-day from the start date to the effective end date (one past the end if the inclusive toggle is on) and counts every day whose UTC day-of-week is Monday through Friday (1 through 5; Sunday is 0 and Saturday is 6 in the JavaScript convention). The result is the raw weekday count. Public holidays are intentionally not subtracted, because the holiday calendar varies by country (and within the United Kingdom by constituent country, and within the United States by state and by industry). The correct workflow is to use this figure as the baseline and subtract your country's gazetted holiday count separately.
The includeEndDate toggle affects all three computations identically: it shifts the effective end forward by 24 hours (one calendar day) so that the end date itself is counted as part of the interval rather than as the boundary.
A worked example.
Take a start date of March 15, 2020 and an end date of May 26, 2026, with the inclusive toggle left off (standard half-open counting). The Gregorian walk gives 6 years (2026 minus 2020, no boundary adjustment because May 26 is after March 15), then 2 months from March 15, 2026 to May 15, 2026, then 11 days from May 15 to May 26. So the human-readable answer is '6 years, 2 months, 11 days'. The aggregate totalDays figure is 2,263 — counting every 24-hour rotation of Earth between the two dates, including the two leap days from 2020-02-29 (already passed before the start) and 2024-02-29 (inside the interval). Notice that a naïve year-times-365 multiplication would say 6 × 365 + 2 × 30 + 11 = 2,261 days, missing the 2024 leap day; the calculator's actual figure of 2,263 includes it and the small drift from the 30-day-month approximation. Total weeks is 2263 / 7 = 323.29 (rounded to two decimal places). Total hours is 2263 × 24 = 54,312. Total minutes is 2263 × 1440 = 3,258,720. Business days: 2020-03-15 was a Sunday, so the iteration begins on Sunday and runs through Monday, May 25, 2026 (the day before the end date, because the half-open interval excludes the end). Of the 2,263 iterated days, 1,616 are weekdays — counting Sundays and Saturdays separately and subtracting them from the total. If you wanted to count actual working days in the United States for that span, you would subtract roughly 6 × 11 = 66 federal holidays plus a handful of state-specific days, giving roughly 1,550 net working days. If you flip the inclusive toggle to 'Yes', every figure increases by one day (2,264 total days, 12 days in the trailing component, 1,617 business days because May 26, 2026 is a Tuesday).
Frequently asked questions.
Does the calculator count leap years correctly?
What counts as a business day?
What is the difference between counting calendar years and total days?
How does the calculator handle time zones?
What is the difference between inclusive and exclusive end-date counting?
Why are the years, months, and days figures sometimes different from what I get by hand?
Can the calculator compute the duration between two times on the same day, or does it only handle whole dates?
How do I count working days in a specific country with its actual public holidays?
What is ISO 8601 and why does the calculator insist on YYYY-MM-DD?
Does the calculator support BCE/BC dates or dates before 1582?
References& sources.
- [1]International Organization for Standardization, ISO 8601-1:2019 — Date and time representations for information interchange. The international standard defining YYYY-MM-DD and related unambiguous date/time formats used by this calculator's data layer.
- [2]Pope Gregory XIII, Inter gravissimas (24 February 1582). The papal bull that introduced the Gregorian calendar — the leap-year rule (every 4 years, except century years not divisible by 400) is the rule this calculator's calendar walk encodes.
- [3]Hinnant, H. (2018). Extensions to the C++ chrono library based on the calendar and time-zone libraries (P0355R7). The proposal that became part of C++20, formalising calendar-walking arithmetic (year/month/day decomposition with month-end clamping) and Gregorian-rule leap-year handling — the same model this calculator implements.
- [4]Internet Engineering Task Force, RFC 3339 — Date and Time on the Internet: Timestamps (Klyne & Newman, 2002). The IETF profile of ISO 8601 used by virtually every internet protocol; defines the UTC 'Z' suffix and the timestamp grammar the calculator uses for unambiguous UTC anchoring.
- [5]U.S. National Institute of Standards and Technology (NIST), Time and Frequency Division. Maintains UTC(NIST), the U.S. realisation of Coordinated Universal Time against which the calculator's UTC-midnight anchors are defined.
- [6]International Earth Rotation and Reference Systems Service (IERS), Bulletin C — Leap second announcements. Governs the relationship between UTC and TAI; the basis for the day-count arithmetic the calculator performs at the UTC layer.
- [7]IANA Time Zone Database (tz database / zoneinfo). The canonical source for civil time-zone rules and historical DST transitions — the reason the calculator anchors at UTC midnight rather than local midnight to immunise day counts from DST shifts.
- [8]Dershowitz, N. & Reingold, E. M. (2018). Calendrical Calculations: The Ultimate Edition (4th ed.). Cambridge University Press. The definitive academic reference on calendar arithmetic across the Gregorian, Julian, Hebrew, Islamic, Persian, Chinese, and Hindu calendars — the source for the proleptic-Gregorian backward-extension convention discussed in the FAQs.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 313 calculators remain free
- No billing is enabled