Audited ·Last updated 27 Jul 2026·8 citations·Tier 1·0 uses

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

Enter as ISO 8601 (YYYY-MM-DD). The earlier of the two dates — the calculator counts forward from here.
Enter as ISO 8601 (YYYY-MM-DD). Must be on or after the start date — the calculator rejects reversed ranges instead of silently swapping them.
Include end date in the count
Total days
2,263
Whole 24-hour spans between the two dates, anchored at UTC midnight so daylight-saving transitions cannot perturb the count. Every leap day in the interval is included automatically.
Years
6
Months
2
Days
11
Total weeks
323.29 weeks
Total hours
54,312 hrs
Total minutes
3,258,720 min
Business days
1,616 days

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. Use 'Total hours' and 'Total minutes' for SLA computations, billing reconciliation, and timesheet math where smaller units matter.
  7. 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.

T = (end − start) ⁄ 86 400 000 ms

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.

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).

end Date2026-05-26
include End Datefalse
start Date2020-03-15

Frequently asked questions.

Does the calculator count leap years correctly?
Yes. The arithmetic walks the Gregorian calendar one calendar unit at a time and uses UTC-midnight day deltas for the aggregate totalDays figure, which automatically counts every leap day in the interval — no special-case logic needed. The Gregorian leap-year rule it encodes is: every year divisible by 4 is a leap year, except century years not divisible by 400. That means 2000 was a leap year (divisible by 400), 1900 was not (divisible by 100 but not 400), and 2100 will not be. A naïve 365.25-day approximation drifts by about three days every 400 years; the calendar walk this calculator uses is exact.
What counts as a business day?
Monday through Friday — five days per week — based on the UTC day-of-week of each date in the interval. Public holidays are intentionally NOT excluded, because the holiday calendar varies by country and even within a country by jurisdiction and industry. The United States has 11 federal holidays observed by banks and the federal government; the United Kingdom has 8 bank holidays in England and Wales, 9 in Scotland, and 10 in Northern Ireland; Kenya has 12 gazetted public holidays per the Public Holidays Act. The right workflow is to use the calculator's weekday-count figure as a country-neutral baseline and subtract your local holiday count separately. For trade settlement (T+2), court-filing deadlines, and payroll accruals you will also need to factor in industry-specific closure days (e.g. NYSE holidays for U.S. equity markets, federal court closures for U.S. court filings).
What is the difference between counting calendar years and total days?
'One year, two months, and three days' is not the same fixed number of total days every time. The length depends on which calendar months the interval traverses, because February has 28 or 29 days, April and June and September and November have 30, and the remaining months have 31. A January-to-April interval is shorter than an April-to-July interval of the same nominal 'three months' because it spans February. The calendar-walking decomposition this calculator uses produces the answer humans say out loud ('six years, two months, eleven days') while the aggregate totalDays figure produces the unambiguous single-number answer (2,263 in the worked example). Use the decomposition for milestones, contracts, and conversational answers; use totalDays for billing, analytics, and any place a single number is needed.
How does the calculator handle time zones?
It anchors every date to UTC midnight before computing any difference, so the calculation is immune to local time-zone offsets and to daylight-saving-time transitions. If you computed a day delta in local time, a daylight-saving spring-forward between the two dates would shorten the interval by an hour and a fall-back would lengthen it by an hour, and an interval that is exactly N days in real-clock terms could round to N±1 depending on which side of the transition you measured from. UTC has no DST. For most everyday use this distinction does not matter; for forensic timestamping, contract effective dates that span DST boundaries, and any cross-time-zone billing, the UTC anchoring is the correct default. If you need the result in a specific local time zone (e.g. counting business days as observed in Nairobi, EAT, UTC+3), convert your input dates to that zone's local YYYY-MM-DD before entering them — the difference between two local dates is the same whether you anchor it in UTC or in the local zone, as long as both ends are anchored the same way.
What is the difference between inclusive and exclusive end-date counting?
Exclusive (the default) treats the interval as [start, end) — the start date is included, the end date is the boundary you cross, not a day you spent. An interval from Monday to Friday is four days, because you spent Monday, Tuesday, Wednesday, and Thursday nights and woke up on Friday. This matches the convention used by every database, every standard-library date class, and every project-management tool. Inclusive treats the interval as [start, end] — both endpoints count. The Monday-to-Friday interval becomes five days. Switch to inclusive when both endpoints are days you possess rather than boundaries you cross: hotel nights counted as 'check-in date through check-out date inclusive', contract durations counted from the first to the last day inclusive, vacation periods where you count the day you arrive and the day you leave as separate days, and statutory deadline windows where the legislative drafter explicitly said 'inclusive of both endpoints'.
Why are the years, months, and days figures sometimes different from what I get by hand?
The most common source of disagreement is the end-of-month edge case. Naïve hand calculation often says 'January 31 plus one month equals March 3' (because February only has 28 days), but the correct calendar-walking answer is February 28 (or 29 in a leap year). This calculator follows the JavaScript Date convention, which clamps to the last day of the target month — so January 31 plus one month is February 28 in a non-leap year, February 29 in a leap year. The other common source of disagreement is what counts as 'a year' across a leap day. If you were born on February 29, 2000 and you ask the calculator 'how old am I on February 28, 2025', it will say 24 years, 11 months, 27 days (because February 28 is one day short of the leap-year anniversary). The legal convention in most common-law jurisdictions is that you turn 25 on March 1; the calculator returns the literal day count and leaves the legal interpretation to you.
Can the calculator compute the duration between two times on the same day, or does it only handle whole dates?
This widget handles whole calendar dates only — the smallest unit it accepts is one day. If both inputs are the same date, the totalDays figure is 0 (or 1 with the inclusive toggle on, since the single day itself is then counted). For sub-day duration calculations (hours and minutes between two timestamps within the same day), use a time-difference calculator that accepts HH:MM:SS inputs. For datetime intervals that span days and need sub-day precision (e.g. a meeting that ran from Monday 14:30 to Wednesday 09:15), break the problem into the day-level component (handled here) plus the time-of-day adjustment (computed separately and added).
How do I count working days in a specific country with its actual public holidays?
Start with the businessDays figure from this calculator — that gives you the country-neutral Monday-through-Friday baseline. Then subtract every public holiday in your country that falls on a weekday inside the interval. For the United States, that means subtracting up to 11 federal holidays per year (New Year's Day, MLK Day, Presidents' Day, Memorial Day, Juneteenth, Independence Day, Labor Day, Columbus Day, Veterans Day, Thanksgiving, Christmas) — some are observed on Mondays so they always fall on a weekday, others are date-fixed so they sometimes fall on weekends and shift to the nearest weekday or are simply lost. For the United Kingdom, subtract 8 to 10 bank holidays depending on the constituent country. For Kenya, the Public Holidays Act lists 12 gazetted holidays (Madaraka Day on 1 June, Mashujaa Day on 20 October, Jamhuri Day on 12 December, etc.). For Japan, 16 national holidays. Specialised business-day calculators that build in a specific country's holiday list can do this subtraction automatically; this calculator deliberately stays country-neutral so it works everywhere.
What is ISO 8601 and why does the calculator insist on YYYY-MM-DD?
ISO 8601 is the international standard for unambiguous date and time exchange, maintained by the International Organization for Standardization (ISO 8601-1:2019 is the current revision). The YYYY-MM-DD format the calculator uses (the 'extended calendar date' form) eliminates the long-running transatlantic confusion between MM/DD/YYYY (used almost exclusively in the United States) and DD/MM/YYYY (used almost everywhere else). The string '03/04/2026' is genuinely ambiguous — it means April 3 in New York and March 4 in London — but '2026-04-03' is unambiguous on every passport-control screen, in every database export, and in every wire-format API on the planet. The format also has the convenient property that lexicographic string sorting matches chronological order: '2025-12-31' sorts before '2026-01-01' as a string AND as a date. Every modern database engine, every cloud API, and every standards-aware programming language uses ISO 8601 in its data layer; localised formats are a presentation-layer concern.
Does the calculator support BCE/BC dates or dates before 1582?
Not officially. The Gregorian calendar was introduced by Pope Gregory XIII in October 1582 to correct accumulated drift in the older Julian calendar, and it was adopted only gradually over the next three and a half centuries (Catholic countries first, Protestant countries through the 18th century, Russia in 1918, Greece in 1923, Turkey in 1926). For dates before each country's adoption, the historically correct calendar is the Julian or one of several local variants — not the Gregorian. The 'proleptic Gregorian' calendar that this calculator effectively uses extends the modern rules backward in time, which is mathematically consistent but historically anachronistic; a date written 'October 10, 1492' in a historical document is a Julian date, not a Gregorian one, and the difference between the two is about 10 days at that point in history. For astronomical and astronomical-software contexts the proleptic Gregorian backward extension is the standard convention; for genealogical and historical contexts the right answer depends on the source document's calendar. The calculator accepts dates as far back as the JavaScript Date object allows (about year ±275,760), but interpret pre-1582 results with care.

References& sources.

  1. [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. [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. [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. [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. [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. [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. [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. [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
Coming soon