How this works
Pick a start and end date and the calculator returns the gap two ways: as a calendar description ("3 years, 7 months, 12 days") and as raw totals (days, weeks, months). The calendar form mirrors how people speak about durations in real life — "we've been together 3 years and 4 months" — while the totals form is what you need for project planning, contract durations, or anything where you have to feed a single number into another calculation.
The formula
Total days come from the millisecond difference between the two dates, divided by 86,400,000 (ms/day) and floored. Weeks = floor(days / 7). Total months ≈ years × 12 + months from the calendar walk above. Leap years and DST shifts are handled by the underlying Date arithmetic — if the end moment is even one second before the start time-of-day, the day count is one less than you might expect.
Example calculation
- Start date 2000-01-01, end date 2024-04-28.
- Years = 2024 − 2000 = 24. Months = 4 − 1 = 3. Days = 28 − 1 = 27. No borrow needed.
- Result: 24 years, 3 months, 27 days. Total days ≈ 8,884. Total weeks ≈ 1,269. Total months ≈ 291.
Frequently asked questions
Why does the y/m/d breakdown not match the total days I expected?
Because months don't have a fixed number of days. "1 month" can be anywhere from 28 to 31 days. The y/m/d breakdown follows the calendar walk (which mirrors how people speak); the total-days figure is the literal millisecond count divided by 86,400,000. Both are correct — they're just answering different questions.
Can I get the difference in hours or seconds?
Not yet — the date inputs are day-precision only, so sub-day units would be misleading. If you need that level of detail, multiply the total-days figure: total hours = days × 24, total seconds = days × 86,400. We may add a date-and-time variant later.
Why does the calculator say "Start date must be on or before the end date"?
Because a negative duration doesn't mean much in this calculator. If you genuinely want to know "how long ago was X", swap the dates: put the older one first. The mathematics works either way; the UI just refuses to render negative numbers.