Date Difference Calculator (Years / Months / Days)
Break the gap between any two dates into a Y/M/D triple using the standard borrow-forward rule, plus the total in days, weeks, and months for cross-checking.
Result
How to use this calculator
- Pick the two dates โ order does not matter unless you choose Strict mode.
- Read the headline Y/M/D under "Difference".
- Use the breakdown rows when you need the same gap expressed as a single quantity (days, weeks, months, decimal years).
About this calculator
How long between two dates? Most date math tools give you a single big number โ say, 4,326 days โ which is correct but rarely what you want to read. The standard human form is "11 years, 10 months, 5 days", computed by the borrow-forward rule: subtract the day, month, and year fields directly; if days come out negative, borrow the day-count of the previous month; if months come out negative, borrow 12 and decrement the year. That rule sounds simple but it has to handle February properly across leap years, which is where many DIY versions go wrong. This tool runs the rule cleanly and also gives you the total in days, weeks, and months so you can cross-check.
How it works โ the formula
Y/M/D borrow-forward:
d = end.day โ start.day; if d<0 โ d += days_in_month(end.monthโ1); m โ= 1
m = end.month โ start.month; if m<0 โ m += 12; y โ= 1
y = end.year โ start.yearDate differences cannot be done in arithmetic alone because months have variable length. The borrow-forward rule mirrors the way you would subtract dates by hand, replacing the day-borrow with the length of the month being crossed. That length is calendar-aware (28/29/30/31), so February + leap years come out right automatically.
Worked examples
- Inputs:
- start = 2024-01-05, end = 2024-01-20
- Output:
- 0y 0m 15d
- Inputs:
- start = 2020-02-15, end = 2020-03-05
- Output:
- 0y 0m 19d (borrow uses 29-day Feb 2020)
- Inputs:
- start = 2020-06-15, end = 2024-03-10
- Output:
- 3y 8m 24d (borrow uses Feb 2024 = 29 days)
Limitations
- Y/M/D durations are not strictly additive โ adding 1 month to Jan 31 lands on Feb 28/29, and the inverse difference is "1 month 0 days", not "1 month โ2/โ3 days".
- No time-of-day component โ both inputs are interpreted as midnight UTC. For "X hours Y minutes" durations use a time-difference calculator.
- No accounting for the proleptic Gregorian calendar boundary; valid for all dates ISO 8601 supports (year 0 โ 1 BCE).
Calculation is calendar-aware and exact for any pair of dates within the Date.parse range your browser supports.