Date difference calculator: years, months and days
Pick a start date and an end date to get the exact gap in years, months and days, plus totals in days and weeks.
Runs in your browser · Excel notes from Microsoft SupportLast reviewed: October 9, 2026
The short answer
To find the difference between two dates, count the whole months from the start date, then the days left until the end date, and group every 12 months into a year. From March 11, 2024, to September 30, 2026, that is 2 years, 6 months, 19 days, or 933 days. The end date is not counted unless you include it.
How it is calculated
Difference = whole months from the start date + leftover days
Years = months ÷ 12 (the remainder stays as months)
Total days = end date − start date (+1 to include the end date)
Weeks = total days ÷ 7 (the remainder stays as days)
Worked example
Michael started a job in Chicago on March 11, 2024, and wants his exact length of service on September 30, 2026, and the Excel formula for his spreadsheet.
- Whole months from March 11, 2024, to September 30, 2026: 30, which is 2 years and 6 months
- Days left after the last whole month (September 11 to 30): 19
- Total: 933 days, or 133 weeks, 2 days
- Including the end date adds one day: 934 days
- Excel formula:
=DATEDIF(DATE(2024,3,11),DATE(2026,9,30),"Y")&" years, "&DATEDIF(DATE(2024,3,11),DATE(2026,9,30),"YM")&" months, "&DATEDIF(DATE(2024,3,11),DATE(2026,9,30),"MD")&" days"
Michael's service: 2 years, 6 months, 19 days (933 days).
Quick reference table
| From | To | Days (end excluded) | Days (end included) | Years, months, days |
|---|---|---|---|---|
| January 1, 2026 | December 31, 2026 | 364 | 365 | 0y 11m 30d |
| January 1, 2024 | December 31, 2024 | 365 | 366 | 0y 11m 30d |
| February 1, 2026 | February 28, 2026 | 27 | 28 | 0y 0m 27d |
| January 31, 2026 | March 1, 2026 | 29 | 30 | 0y 1m 1d |
| October 8, 2026 | December 31, 2026 | 84 | 85 | 0y 2m 23d |
| February 29, 2024 | February 29, 2028 | 1461 | 1462 | 4y 0m 0d |
Special cases and common mistakes
- Inclusive or exclusive? Subtracting dates leaves the end date out: January 1 to December 31, 2026, is 364 days. Counting both days (hotel nights do not; vacation days often do) gives 365. Check "Include the end date" when both days count.
- Month ends: one month after January 31 is the last day of February. So January 31 to March 1, 2026, is 1 month and 1 day, not 29 days.
- Leap years: February 29, 2024, to February 28, 2025, counts as one full year here, because 2025 has no February 29.
- Excel DATEDIF quirks: Microsoft notes that the "MD" unit can return a negative, zero or inaccurate result, and that a start date after the end date returns #NUM!. The formula above always puts the earlier date first.
- Use it for anniversaries and tenure. Years, months and days is the format most people quote for time on the job, time in a lease or the length of a marriage. Use the day total when a deadline or contract is written in days.
Frequently asked questions
How do I calculate the number of days between two dates?
Subtract the start date from the end date. The calculator shows the total instantly; add one day if both the first and last day should count.
How do I get the date difference in years, months and days?
Count whole months from the start date, convert each 12 months into a year, and count what is left over as days. The calculator does this and also shows the total in months and weeks.
What is the Excel formula for the difference between two dates?
Use =DATEDIF(start,end,"Y") for years, "YM" for the remaining months and "MD" for the remaining days, joined with &. The calculator builds the full formula with your dates so you can paste it into a cell.
Does a date difference calculator include the end date?
Most do not, and neither does plain subtraction or Excel. Turn on "Include the end date" to count both days, for example when totaling vacation days.
How many weeks are between two dates?
Divide the day total by 7. In Michael's example that is 133 weeks, 2 days.
Sources
- Microsoft Support: DATEDIF function (units Y, YM, MD and known issues) (Last reviewed: October 9, 2026)