Duration Calculator
Calculate the exact time between two dates in years, months, and days — plus total days (and optional weeks/hours).
Background
A “duration between dates” can be measured in two common ways: (1) total days and (2) calendar time (years/months/days). This calculator uses calendar-accurate month lengths and leap years to produce a clean Y / M / D breakdown.
How to use this calculator
- Pick a start date and an end date (or enable Until today).
- Choose options like inclusive end day or auto-swap.
- Click Calculate to get calendar duration (Y/M/D) and total days.
How this calculator works
- Total days: counts calendar days between the dates (optionally inclusive).
- Calendar duration: finds full years, then full months, then remaining days.
- Leap years & month length: automatically handled by real calendar dates.
Formula & Equations Used
Total days (exclusive): difference in UTC date-only timestamps.
Inclusive option: days_inclusive = days_exclusive + 1
Calendar breakdown: accumulate whole years → whole months → leftover days.
Example
Example — 2020-02-29 to 2025-02-28
Calendar duration is computed using real month lengths. Depending on “Include end day,” the total-day count differs by 1.
Frequently Asked Questions
Q: Why do “total days” and “years/months/days” feel different?
Total days is a straight count. Years/months/days is calendar-based (months differ in length), so it’s reported as whole units.
Q: What does “Include end day” mean?
If start and end are the same date, exclusive gives 0 days, inclusive gives 1 day (counting that day).
Q: Why swap reversed dates?
It prevents errors when someone accidentally enters the later date as the start date.