Date Difference Calculator
Find the exact number of years, months, weeks, and days between any two dates.
What is Date Difference Calculator?
The date difference calculator tells you the exact time between any two dates, broken down into years, months, weeks, days, and hours. It works for any pair of dates — past, future, or one of each.
Formula
The calculator subtracts the year, month, and day components of the two dates and "borrows" from months or years when days or months go negative, the same way you would subtract a date by hand. Total days are computed from the millisecond difference divided by 86,400,000.
Worked example
From Jan 1, 2020 to Apr 20, 2026:
- Years: 2026 − 2020 = 6
- Months: 4 − 1 = 3
- Days: 20 − 1 = 19
- = 6 years, 3 months, 19 days
- Total days = 2,301
How to use this calculator
- Pick the start date.
- Pick the end date (defaults to today).
- See the breakdown in multiple units. If the end date is earlier than the start date, the result is shown with a minus sign but is otherwise identical in magnitude.
Frequently asked questions
Does this count leap years?
Yes. JavaScript's Date object handles leap years correctly, so February 29 is counted as an extra day in leap years.
Why are the months and days not a simple subtraction?
Because months have different lengths. "1 month" can be 28, 29, 30, or 31 days depending on where you are in the calendar. The calculator uses a standard "same day of next month" convention.
Does this include the end date?
No, it measures the interval between the two dates. To get an inclusive count (e.g., for a vacation that runs Mon through Fri = 5 days), add 1 to the total days.
Can I calculate business days only?
This calculator returns calendar days. For business-day math excluding weekends and U.S. federal holidays, use a business-day calculator instead.