Years, Months and Days Calculator for Date Durations
Enter a start date and an end date to see the duration as years, months and days, together with total days, full months and weeks. The calculation uses calendar dates instead of a rough 30-day month estimate.
Enter two dates
Choose the beginning and end of the period. If the dates are entered in reverse order, the calculator sorts them and explains the correction in the result.
The calculation runs in this browser. Your dates are not sent to a calculation server.
Calculation result
=DATEDIF(A2,B2,"Y")&" years "&DATEDIF(A2,B2,"YM")&" months "&DATEDIF(A2,B2,"MD")&" days"
How to calculate years, months and days
- Enter the first date of the period as the start date and the last date as the end date. For an age-style check, enter the date of birth first and today as the end date.
- Choose the counting rule. Elapsed duration is the normal date difference. Use the inclusive option only when the first and last dates both count as included days.
- Read the main result as a calendar duration, then check the separate values for complete years, remaining months, remaining days, total months and total days.
- Review the notes below when the period crosses a month end, February 29, a leap year or a policy that defines the start and end date differently.
- If the result must be maintained in Excel, use the DATEDIF examples as a starting point and keep the same date-inclusion rule in both places.
What does a years-months-days duration mean?
A years-months-days result describes the distance between two calendar dates using calendar units instead of one approximate number. For example, a period from April 15, 2024 to July 20, 2026 can be read as 2 years, 3 months and 5 days. This format is useful for employment duration, contract length, age checks, subscriptions, service periods and any situation where a total-day number is difficult to interpret.
The calculator finds complete calendar months between the normalized dates, converts groups of 12 months into years, keeps the remainder as months, and counts days after the last month anchor. This is different from dividing total days by 30 or 30.44, because it follows the actual month and day positions.
Month ends need care: January has 31 days, February 28 or 29, and other months 30 or 31. January 31 to February 28 cannot be interpreted reliably with a 30-day estimate. This page clamps the month anchor to the shorter month and shows total days separately.
The result is a calendar reference, not a legal definition. Employment, insurance, leases, billing, leave, deadlines and official forms may define endpoint counting or anniversary handling differently. Follow the governing document or ask the responsible office when the result affects a formal decision.
Compare date-inclusion rules
The same two dates can produce a different day count when the final date is included. Decide the rule before sharing a result so that a spreadsheet and a manual calculation use the same convention.
| Rule | How it works | Useful for |
|---|---|---|
| Elapsed duration | Returns the calendar difference from the start date to the end date, normally without adding the end date as an extra day. | Age-style durations, elapsed periods and calendar date differences |
| Both dates included | Adds one day to the end of the range so that the first and last dates are counted as included days. | Usage days, covered days and schedules that count both endpoints |
| Complete-month breakdown | Finds complete months first, converts every 12 months into one year and leaves the remaining days as a separate value. | Employment, contract, membership and age-style explanations |
| Total days only | Shows the date difference as one number without assigning meaning to years or months of different lengths. | Deadlines, day limits and calculations that need a numeric day count |
Examples of years, months and days calculations
Select an example to load it into the calculator. In practical work, record the date rule with the answer instead of saving only the final number.
| Example | Elapsed answer | What to check |
|---|---|---|
| 2 years 3 months 5 days | Complete years and months are fixed before the remaining days are counted. | |
| 1 month | A month-end date is aligned with the end of the shorter month. | |
| 12 months | The next year does not have February 29, so the month-end rule matters. | |
| 6 months | The same day of the month is six months later, leaving zero extra days. | |
| 0 days (1 day when inclusive) | Elapsed duration and included usage days answer different questions. |
Calculate years, months and days in Excel
Excel can split a date range into calendar units with DATEDIF. With the start date in A2 and end date in B2, the Y, YM and MD units return complete years, remaining months and remaining days. Joining them creates a result such as 2 years 3 months 5 days.
DATEDIF is useful, but MD can behave unexpectedly around month ends. Cross-check with B2-A2 or DAYS(B2,A2), and apply the same endpoint rule consistently instead of adding a day in only one part of the workbook.
To update through today, replace B2 with TODAY(). DATEDIF(A2,TODAY(),"Y") changes whenever the workbook recalculates, so freeze the calculation date when the result is needed for a record.
If Excel and this page disagree, check whether the cells are real dates, whether the inclusive setting matches, whether a time value is hidden, and whether the same date system is used.
Complete years
=DATEDIF(A2,B2,"Y")
Returns the number of complete years in the period.
Months after years
=DATEDIF(A2,B2,"YM")
Returns the remaining months after complete years.
Days after months
=DATEDIF(A2,B2,"MD")
Returns remaining days after complete months; check month-end cases.
Total days
=B2-A2
Returns the calendar date difference as one numeric value.
Month-end, leap-year and reverse-input notes
Do not treat every month as 30 days
A calendar month can contain 28, 29, 30 or 31 days. A total-day value divided by 30 is only an approximation and should not replace a calendar-month result when the exact dates matter.
Periods involving February 29
When February 29 is a start or end date, the following year may not contain the same day. The calendar-month anchor and the total-day result can therefore deserve separate review.
Reversed dates are sorted automatically
The calculator places the earlier date first and explains the correction. Check the original order before saving the result.
Inclusive counting can add one day
Elapsed duration from a date to itself is zero days; a schedule that counts that date may call it one day. Confirm the organization or document rule.
Weeks are a reference conversion
Weeks are calculated by dividing total days by seven. They are shown as a decimal reference and are not a replacement for a years-months-days calendar breakdown.
Formal decisions need the governing rule
This tool supports ordinary calendar calculations. For employment, insurance, leases, billing, leave, deadlines or government procedures, use the official instructions or contract definition.
Frequently asked questions 8 questions
Find complete calendar months, convert each group of 12 into a year, and count days after the last month anchor. Total days provide a cross-check.
A month calculator emphasizes complete months. This calculator splits them into years and remaining months, then adds remaining days. Use the related page when total months are the main answer.
The normal elapsed-duration mode returns the date difference. If both endpoints represent covered or used days, choose the inclusive reference mode and confirm that it matches the rule used by your contract, schedule or form.
A calendar-month interpretation can align month-end with the shorter month's end, producing one complete month. Formal records should follow the applicable anniversary policy.
Yes. February 29 changes total days, and the calendar split depends on both date positions. Check total days and calendar units.
Yes. Combine DATEDIF with the Y, YM and MD units to show years, remaining months and remaining days. Check total days with B2-A2 or DAYS(B2,A2), and apply the same endpoint rule in the workbook.
Enter a birth date and today for an informational duration. Official eligibility or administrative procedures may use a specific reference date, so follow that rule.
The calculation runs in browser JavaScript and does not send dates to a calculation server. History, autofill and storage follow your browser and device settings.
Reference material
For workbooks and formal records, review the official Microsoft and Google documentation for DATEDIF and date arithmetic. The formula and the date-counting rule should be checked together.