A date difference in years, months, and days is the calendar-correct split of the gap between two dates into three plain-language parts — the whole years, then the whole months left over, then the leftover days — and the Date Difference Calculator fills those parts the same way the popular date-fns intervalToDuration function does, by anchoring on the start date and moving forward one whole year, one whole month, and finally one day at a time. That ordering matters more than it sounds, because months have different lengths, February has 29 days in some years, and a one-day-short gap is not rounded up to a full month. The result reads the way you would naturally say it, such as "1 year, 2 months, and 5 days," and the parts always add back up so that the start date plus the breakdown lands exactly on the end date. The same calendar-correct approach is what lets the tool handle past-to-future gaps, future-to-past gaps, and same-day pairs without ever returning a negative answer.

how to calculate date difference in years months and days
How to Calculate Date Difference in Years, Months & Days

Reading Date Gaps in Years, Months, and Days

Total days tells you the size of a gap; the years, months, and days split tells you the shape. The two views answer different questions. Total days is the right unit when you are counting down to a deadline, projecting a daily budget, or comparing two trips to the day. The Y/M/D breakdown is the right unit when you are describing a life event, a contract term, or a project's age — anything you would speak about in rounded units rather than exact counts. Real-world gaps rarely come out as a clean year or a clean month, so the breakdown has to handle every awkward leftover, including the case where the leftover is 0 days and the case where it is 30 days because the gap is one day short of a full 31-day calendar month.

The single most common request of a date gap is also the deceptively trickiest one. Counting complete months alone is not enough, because a 28-day February and a 31-day May behave very differently when used as the unit. The Date Difference Calculator applies the same end-of-month clamping that adding months to a date uses, so a span that is one day short of a full month is counted as months minus one with the extra days left over, never as the next rounded-up whole month. The table below summarises every output the tool shows and how each one is calculated.

OutputWhat it showsHow it is calculated
Total daysExact calendar gapDay-of-year difference with full leap-year rule
Weeks between datesRounded week countTotal days divided by 7, rounded down
Complete monthsWhole-month count onlyCalendar-anchored fill, never rounded up
Years, months, daysSpoken-language gapSame method as date-fns intervalToDuration
Weekday split (optional)Working days vs weekend daysMon–Fri versus Sat–Sun, sums to total

How to Find the Breakdown in Three Steps

  1. Pick your start date in the first field. The picker defaults to today's date, so leave it as today to count forward from now, or change it to any past or future date.
  2. Pick your end date in the second field. The output updates the instant either date changes, with no Calculate or submit button to press.
  3. Read the total days, weeks between dates, complete months, and the years, months, and days split instantly below the two pickers. Tick the weekdays only toggle to switch the view from a calendar split to a Monday-to-Friday versus weekend split.

The two pickers update the result live, so you can scrub through timelines or compare alternative end dates by clicking around in the calendar without losing your place. Everything runs in your browser, the dates you enter never leave your device, and there is no signup, no daily limit, and no upload step. Picking the same date twice returns zero across every output, which is the cleanest way to confirm the result panel updates correctly before trying a real pair.

Why the Y/M/D Split Is Harder Than Total Days

Total days is a single signed subtraction of day numbers across the calendar grid, so it is one continuous calculation a spreadsheet can do in one cell. A years, months, and days breakdown, by contrast, is three different units stacked on top of each other, and each unit interacts with the ones below it. The classic naive approach — divide total days by 365 for years, then by 30 for months, then take the remainder as days — produces answers that are off by one almost every time the start date sits near the end of a month or near February 29 in a leap year.

Three rules make the breakdown calendar-correct instead of approximate. First, fill whole years first by adding exactly one calendar year to the start date and locking the year part, then work the remainder in months from the new anchor. Second, fill whole months from that year-shifted anchor, clamping the day to the last day of the target month when the start day is past the month's last day — the same rule that prevents January 31 plus one month from becoming March 3. Third, fill leftover days one at a time, which automatically absorbs the leap-day adjustment for February.

The Gregorian calendar's leap-year rule is fully respected: a year is a leap year when it is divisible by 4, except for century years unless they are also divisible by 400. That is why 2000 was a leap year, 1900 was not, and February has 29 days in 2024 but 28 days in 2023. The tool applies this rule automatically, so a gap that crosses February 29 comes out one day longer than the same span in a non-leap year, and you never have to flag the leap year yourself.

Worked Example: April 15, 2021 to June 20, 2022

To see the Y/M/D breakdown in action, take a clean non-leap-to-non-leap-year span where every part of the breakdown is non-zero. The start date is April 15, 2021 and the end date is June 20, 2022, and both years are non-leap years so the year span itself is a plain 365 days.

Step one — fill whole years from the start date. April 15, 2021 plus one calendar year is April 15, 2022, so lock the years part as 1 year. The remaining gap is from April 15, 2022 to June 20, 2022.

Step two — fill whole months from the year-shifted anchor. April 15 to May 15 is one month (30 days, since April has 30 days), and May 15 to June 15 is a second month (31 days, since May has 31 days). The end date is June 20, which is past June 15, so stop at 2 months. The remaining gap is from June 15, 2022 to June 20, 2022.

Step three — fill leftover days. From June 15 to June 20 is exactly 5 days, so the days part is 5.

The Date Difference Calculator returns 1 year, 2 months, and 5 days for this span, with 431 total days, 14 complete months, and 61 weeks plus 4 days. A total-days check confirms the breakdown: 365 days in the year span (no leap day crossed) plus 30 days for the first month plus 31 days for the second month plus 5 leftover days equals 431, matching the total. If you had entered the dates in reverse, with June 20, 2022 as the first pick and April 15, 2021 as the second, you would still get 431 days and the same Y/M/D breakdown, because the tool always returns a positive answer regardless of order.

Switching to Weekdays Only

Tick the weekdays only option to swap the gap's view from calendar days to working days. The tool instead breaks the span into weekday days (Monday through Friday) and weekend days (Saturday and Sunday). The two numbers always add up to the total calendar days, which makes it easy to estimate working time on a project, a delivery window, or a notice period while still being able to verify them against the total.

The weekday count is calendar-only and does not subtract public holidays, so a span that includes a national holiday still counts that day as a weekday. For a holiday-aware business-days count, use the dedicated Business Days Calculator, which is built for that exact job and skips the public holidays you tell it to skip. Treat the weekdays-only split here as a plain Monday-to-Friday tally, not as a contractual working-day count.

Where the Y/M/D Gap Matters Most

Y/M/D is the natural unit for any span that is spoken or quoted in rounded terms. Legal notice periods, lease terms, contract durations, and notice-of-termination clauses are usually written in years, months, and days. Project plans, course enrollments, and subscription terms read the same way. The breakdown is also how ages are usually expressed, because the Y/M/D split is exactly how people say their age after the first birthday. For a one-off, you can hand-pick the start and end dates here; for an age that updates every birthday, an age calculator tied to a birth date is the right tool.

Common uses that come up in practice are listed below, paired with the reason Y/M/D is the natural unit for each.

Common useWhy Y/M/D is the natural unit
Legal notice periodStatutory clauses are written in years, months, days
Lease or contract termStandard contract language and renewal phrasing
Project or course durationStatus updates and milestone descriptions
Age or anniversaryThe way people actually say their age
Subscription termRenewal and cancellation descriptions

For other single-date operations in the same family, the related calculators cover them: the date add-subtract calculator moves forward or backward from a single date, the age calculator gives a live age from a birth date, and the day-of-week calculator finds which weekday any date falls on. None of these replace the Y/M/D gap for two-date spans, but they cover the natural follow-up questions once you have it.

Related reading: Accurate Date Format Converter: ISO, US, EU, and Words.

Related reading: How to Find Day of Year in Excel Without a Formula.