Date Difference Calculator
Find the exact time between two dates, expressed in years, months and days the way a calendar counts them. The same period is also given as totals of months, weeks, days, hours and minutes, and the order of the dates does not matter.
Today by default.
Result
Enter a start date and an end date.
The calculation runs in this browser tab. Nothing you enter is uploaded, saved or logged.
How is the difference between two dates measured?
There are two ways to measure the gap between dates. One is a pure count of days, which is unambiguous but awkward to read: 1,000 days is not a quantity most people picture. The other is the calendar difference, whole years, then whole months, then the remaining days, which is how people say “two years and three months ago”.
Calendar differences need a rule because months have different lengths. This calculator adds whole months to the start date, keeping the day of the month, and counts the days left over. When the start day does not exist in a later month, such as 31 January plus one month, the last day of that month is used, so 31 January to 29 February 2024 is exactly one month.
How to use the Date Difference Calculator
- Enter the start date and the end date. The end date is set to today by default and can be changed.
- Read the difference in years, months and days at the top.
- Below it, find the same period as total months, weeks, days, hours and minutes, with the weekday of both dates.
- Use Copy result to copy the difference as text, or Reset to start again.
Formula
- Whole months
- m = the largest whole number with (start + m months) ≤ end
- Years, months and days
- years = ⌊m ÷ 12⌋, months = m mod 12, days = end − (start + m months)
- Total days
- days = day number(end) − day number(start)
- Hours and minutes
- hours = days × 24; minutes = days × 1,440
A day number counts the days since a fixed origin, so subtracting two of them gives the exact number of days between the dates, leap days included.
Hours and minutes assume 24-hour days and ignore the time of day, because only dates are entered. To include clock times, use the time duration calculator.
Worked example
Two dates two years and a quarter apart. These are the results the calculator gives:
| Question | Result |
|---|---|
| Input: Start date | 2022-03-15 |
| Input: End date | 2024-06-20 |
| Difference | 2 years, 3 months, 5 days |
| From | Tuesday, 15 March 2022 |
| To | Thursday, 20 June 2024 |
| Total months | 27 months and 5 days |
| Total weeks | 118 weeks and 2 days |
| Total days | 828 |
| Total hours | 19,872 |
| Total minutes | 1,192,320 |
Assumptions and limits
- Only calendar dates are used. Time zones and the time of day do not enter the result.
- The end date is not counted as an extra day: from 1 January to 2 January is 1 day. If you need both dates counted, use the days between dates calculator and choose to include the end date.
- Different tools may give a different number of leftover days for month-end start dates (29th, 30th and 31st), because there are several conventions; the years and the total number of days agree across them.
- Dates use the Gregorian calendar, extended backwards, from year 1 to year 9999.
Frequently asked questions
How do I calculate the difference between two dates?
Count the whole years from the start date, then the whole months that remain, then the days. From 15 March 2022 to 20 June 2024 that is 2 years, 3 months and 5 days. To get a single number, subtract the day numbers: that gives 828 days.
Does the order of the dates matter?
No. If the start is later than the end, the calculator puts the dates in order and tells you so. The size of the gap is the same in both directions.
Is the end date included in the count?
No. The difference between 1 January and 2 January is one day. Counting both dates, as in “both days of a two-day event”, gives one more; the days between dates calculator has an option for that.
How are leap years handled?
Exactly. The calculation uses real day numbers, so 29 February is counted when it lies between the dates. From 28 February 2023 to 28 February 2024 is 365 days, and from 28 February 2024 to 28 February 2025 is 366 days.
How many months is it from 31 January to 28 February?
In a non-leap year, one month: 31 January plus one month does not exist, so the calculator uses the last day of February. The result then shows 0 days left over.
How can I find the difference in weeks?
Divide the total number of days by 7. The calculator gives the whole weeks and the days left over, for example 118 weeks and 2 days.