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

Start date
Day
Month
Year
End date
Day
Month
Year
Ready-to-paste 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"Day count in Excel: =DATE(2026,9,30)-DATE(2024,3,11)

Pre-filled values are an example: March 11, 2024 to September 30, 2026.

Time between the dates
2 years, 6 months, 19 days
In days
933 days
In weeks
133 weeks, 2 days
In months
30 months, 19 days
From
March 11, 2024
To
September 30, 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.

  1. Whole months from March 11, 2024, to September 30, 2026: 30, which is 2 years and 6 months
  2. Days left after the last whole month (September 11 to 30): 19
  3. Total: 933 days, or 133 weeks, 2 days
  4. Including the end date adds one day: 934 days
  5. 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

Common date spans, end date excluded vs. included
FromToDays (end excluded)Days (end included)Years, months, days
January 1, 2026December 31, 20263643650y 11m 30d
January 1, 2024December 31, 20243653660y 11m 30d
February 1, 2026February 28, 202627280y 0m 27d
January 31, 2026March 1, 202629300y 1m 1d
October 8, 2026December 31, 202684850y 2m 23d
February 29, 2024February 29, 2028146114624y 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