Date Difference Calculator
Calculate days, weeks, months, and years between two dates. Perfect for planning events, tracking milestones, and project management.
Reviewed by the Calcura editorial team · Last reviewed
- Question
- How do I count the days between two dates?
- Answer
- diff_days = |date2 − date1| converted to days. The calculation walks the Gregorian calendar including leap years, so counting from Jan 1, 2020 to Jan 1, 2025 gives exactly 1,827 days (accounting for the 2020 and 2024 leap years). For months and years, use approximations: ~30.44 days per month, ~365.25 days per year. That's fine for 'this was about 7 months ago' but not for legal deadlines.
▸Show formula & caveatsHide formula & caveats
- Formula
diff_days = |date2 − date1| (Gregorian calendar)- Caveats
- Include or exclude the end date? Legal and medical conventions differ — 'X days from today' often means today + X.
- Months aren't constant length; month-count is an approximation based on 30.44-day average.
- Time zones matter for same-day differences; use UTC dates to avoid ±1 day errors.
What This Calculator Does
This calculator takes two calendar dates and returns the elapsed days, weeks, months, and years between them. It uses the Gregorian calendar (with leap years) and counts in calendar days, not business days. Results are approximations for 'months' (based on a 30.44-day average) and 'years' (365.25-day average) — useful for narrative answers like 'that was about 7 months ago' but not for legal deadlines, which need exact calendar-month arithmetic.
When To Use This Calculator
Counting down to a deadline or event
From 2026-04-18 to a 2026-09-15 wedding: 150 days, about 5 months — useful for vendor timelines that quote weeks-out-from-event.
Measuring elapsed time since a milestone
Days since a habit start (e.g., a 2024-01-15 quit-smoking date) is a single subtraction, no calendar gymnastics. Convert to weeks or months for readable milestones.
Tenure, probation, or eligibility counts
A 90-day probation from a 2026-02-01 hire date ends on 2026-05-02. An HR system that stores dates in UTC gives a straight day count — this calculator matches it for short spans.
Project status reporting
Days-remaining and days-elapsed for a Gantt entry — even approximate month/year totals help translate a raw day count into something executives parse quickly.
How It Works
The calculator subtracts the two dates in milliseconds and divides by 86,400,000 (ms/day), rounding up so a partial day counts as one. Weeks = floor(days ÷ 7). Months ≈ days ÷ 30.44 (365.25 ÷ 12, the Gregorian average). Years ≈ days ÷ 365.25. The 365.25 average captures the leap year rhythm; the actual Gregorian average is 365.2425, but the difference is under a day over 100 years and rarely matters for user-facing conversions. DST transitions do not affect day counts — only wall-clock durations within a day.
Formula
Days = ceil((end − start) / 86400000 ms)
Weeks = floor(Days / 7)
Months ≈ Days / 30.44
Years ≈ Days / 365.25Real-World Example
Scenario
A founder wants to know how long ago the company incorporated (2021-03-15) as of today (2026-04-18) to put in an investor deck.
Calculation
Days: (2026-04-18 − 2021-03-15) = 1,860 days Weeks: 1,860 / 7 ≈ 265 weeks Months: 1,860 / 30.44 ≈ 61 months Years: 1,860 / 365.25 ≈ 5.09 years
Result
About 5 years and 1 month — usable shorthand for the pitch. For an exact calendar-month-and-day figure ('5 years, 1 month, 3 days'), step through calendar anniversaries rather than relying on a 30.44-day average.
Common Mistakes to Avoid
Mistake: Confusing inclusive with exclusive counts
Solution: From 2026-01-01 to 2026-01-03 is 2 days exclusive (the distance) or 3 days inclusive (day count including both endpoints). The calculator gives the exclusive count; add 1 if you need inclusive.
Mistake: Treating the month count as exact
Solution: '90 days' is almost 3 months but not exactly — 3 calendar months from 2026-01-15 is 2026-04-15 (90 days), while 3 × 30.44 = 91.3 days. For legal 90-day windows, anchor to calendar months from the start date.
Mistake: Forgetting time zones for cross-border events
Solution: A date-only input has no timezone, but if you're measuring 'days since X happened at Y UTC,' crossing a date boundary by a few hours can flip the count by one day. For precise cross-zone counts, use a full datetime.
Mistake: Assuming business-day and calendar-day are interchangeable
Solution: '90 days to close' in a real-estate contract usually means 90 calendar days, not business days — but many legal deadlines (SEC filings, court rules) are explicitly business days. Check the document language; if in doubt, use a workdays calculator.
Date Difference vs. Related Calculators
Age Calculator
For the years-months-days-since-birth breakdown specifically — uses calendar anniversaries rather than day-count averages.
Workdays Calculator
For counts that exclude weekends and holidays — necessary for business-day SLAs and court filings.
Countdown Calculator
For live countdowns to a single future date (hours, minutes, seconds) rather than a static two-date difference.
When This Isn't the Right Tool
Legal statutes of limitation
Use instead: Jurisdictions vary on how deadlines are computed (calendar days, business days, tolling rules). This calculator gives raw elapsed days; verify with the applicable statute or counsel for binding deadlines.
Business-day or holiday-aware counts
Use instead: Use the Workdays calculator. Court filing deadlines, SEC reporting windows, and many payroll rules use business days and skip weekends and designated holidays.
Partial days or sub-day precision
Use instead: This calculator rounds up to whole days. For hour-level differences (flight durations, SLA timers), use a time duration or datetime-difference tool.
Historical calendars (pre-1582)
Use instead: The Gregorian calendar started in 1582. For earlier dates, use a historical-date tool that accounts for the Julian calendar and regional adoption dates.
How to Verify This Calculation
In Excel, =DATEDIF(A1, B1, "d") returns days, "m" returns full calendar months, and "y" returns full calendar years. In Python, (end - start).days does the same. Agreement to within a day confirms this calculator's output for routine spans.
Sources
- NIST — Time and Frequency Division — NIST's reference for civil time and the Gregorian calendar used by date arithmetic in software.
- ISO 8601 — Date and Time Format — International standard for date representation, which underpins date-difference arithmetic in most modern software.
- Federal Rules of Civil Procedure — Rule 6: Computing Time — US federal rules on how to compute deadlines in calendar vs. business days — relevant when using date-difference results for court filings.
Reviewed by the Calcura editorial team · Last reviewed