Date Difference Calculator
Find the exact difference between two dates in years, months, and days. Also shows total days, weeks, and hours between the dates.
Examples
One calendar year
From 1 January 2025 to 1 January 2026.
- Start date
- Jan 1, 2025
- End date
- Jan 1, 2026
Years
1
Months
0
Days
0
Total days
365
Total weeks
52.1
Total hours
8,760
Embed this calculator
Copy a free iframe snippet for articles, learning pages, forums, wikis, newsletters, and internal docs.
How It Works
Formula
Variables, symbols and units
- Milliseconds between the earlier and later date (UTC)
- Whole calendar days between the two dates
- Total hours between the two dates
- Milliseconds in one day (24 × 60 × 60 × 1000)
Calculation method explained
Enter two dates. The calculator determines which is earlier, then computes the difference broken down into years, months, and days. It also calculates the total number of days, weeks, and hours between the two dates.
Calendar-style breakdown of the span between two dates:
- Sort the inputs so the earlier date comes first; the order you typed them in does not matter.
- Tentatively take the year, month, and day differences: , , .
- If the day count is negative, the later date has not yet reached the same day-of-month as the earlier date — borrow the days of the previous month and subtract one from the months count.
- If the months count is then negative, the later month is still before the earlier month within the year — borrow 12 months and subtract one from the years count.
- Compute total elapsed time directly from the timestamps: , , . Dates are parsed as UTC midnight to avoid daylight-saving off-by-ones across the span.
Examples
One calendar yearJan 1, 2025 · Jan 1, 2026 → 1
From 1 January 2025 to 1 January 2026.
- Start date
- Jan 1, 2025
- End date
- Jan 1, 2026
- Years
- 1
Project deadlineMar 15, 2026 · Sep 30, 2026 → 0
A project running from 15 March 2026 to 30 September 2026.
- Start date
- Mar 15, 2026
- End date
- Sep 30, 2026
- Years
- 0
Historical spanJul 20, 1969 · Apr 25, 2026 → 56
From the moon landing (20 July 1969) to 25 April 2026.
- Start date
- Jul 20, 1969
- End date
- Apr 25, 2026
- Years
- 56
Frequently Asked Questions
How is the difference calculated?
The calculator finds the earlier and later date, then counts full years, remaining full months, and remaining days — just like counting on a calendar. Total days are calculated separately as the absolute difference.
Does the order of dates matter?
No. The calculator automatically detects which date is earlier and computes the positive difference. You can enter either date first.
Are leap years handled?
Yes. The calculation uses actual calendar dates, so leap years with 366 days are counted correctly. February in a leap year has 29 days.
What format should I use for dates?
Use the ISO format YYYY-MM-DD (e.g. 2026-04-07 for 7 April 2026). This ensures consistent, unambiguous parsing regardless of locale.
Can I use this for weekday calculations?
This calculator counts every calendar day. Use the Weekdays Calculator when you want a weekday count with a days-not-counted pattern and optional extra dates you provide.