Calculate years months days between dates
To calculate years months days between dates, do not divide total days by an average month or year. Set the endpoints first, then identify complete years, complete remaining months, and the final days on the calendar. This makes results easier to explain for age, employment tenure, and contract periods.
This guide uses the Gregorian calendar and treats a period as the date difference from the start date up to, but not including, the end date unless stated otherwise. Contracts, payroll, leave, and legal procedures may define their own start and expiry rules.
What a years-months-days result means
The phrase calculate years months days between dates describes a request to read a date difference in calendar units instead of one large number. For example, April 15, 2024 to July 20, 2026 is 2 years, 3 months, and 5 days when the period is counted from the start date to the end date. That format is easier to discuss for employment tenure, age, and contract duration.
A total-day result is not interchangeable with a calendar-unit result. Months contain 28 to 31 days, and a leap year adds February 29. Dividing by 365 or 30 creates an estimate, while the years-months-days form marks calendar anniversaries and then the remaining interval. Keep both forms when another person must audit the calculation.
This article explains the result before and after you use the existing years, months, and days calculator. The calculator gives a quick comparison; the guide explains endpoint choices, month-end behavior, leap years, and how to document the rule used.
| Result you need | Useful display | What to record |
|---|---|---|
| Explain a period clearly | Years, months, and days | The complete-unit and remainder rules |
| Check a day limit or deadline | Total days | Whether the start or end date is included |
| Manage work in calendar months | Complete months or years-months-days | Do not convert every month to 30 days |
Choose endpoint and elapsed-day rules first
Before entering dates, write down whether each endpoint counts. An elapsed period normally measures the difference between the start and end dates, so identical dates produce 0 days. A usage count or covered-day count may instead include both endpoints and produce 1 day for the same input.
The same pair of dates can therefore be one day apart depending on the wording. Age and employment tenure often use a complete-anniversary rule, while reservations, events, and billing may count the dates used. Do not infer the rule from a label alone; check the policy, contract, or official instructions.
If the end date precedes the start date, first decide whether the input is reversed or whether a backward interval is intentional. A calculator may sort dates automatically, but a saved record should keep the original entries and state the order used for the displayed answer.
- Choose between an elapsed period and a target-day count that includes endpoints.
- Enter both dates in the same calendar and timezone convention.
- For contracts, employment, insurance, or leave, follow the specialist rule for the applicable start date.
| Rule | Same date result | Example use |
|---|---|---|
| Elapsed period | 0 days | Age, tenure, or a system date difference |
| Start date is day one | Day 1 | A usage count or numbered record |
| Both endpoints included | 1 day | An event or covered-date total |
| Neither endpoint included | 0 days | Comparing only the interval between boundaries |
Break the period into years, months, and days
A calendar calculation should not convert every year and month to an average number of days. First find the largest number of complete years that can be added to the start date without passing the end date. Then find complete months from that new reference date. Finally count the remaining days.
For April 15, 2024 to July 20, 2026, April 15, 2026 is two complete years after the start. July 15, 2026 is three complete months after that reference date, and July 20 is five days later. The result is therefore 2 years, 3 months, and 5 days. Updating the reference date at every step prevents a remainder from being counted twice.
If a report is managed in months, 2 years and 3 months can also be written as 27 complete months. That is a different presentation from 2 years, 3 months, and 5 days. Confirm the unit expected by the recipient before choosing a label for a job record, invoice, or contract summary.
- 1. Find the largest complete-year count that does not pass the end date.
- 2. From the updated reference date, find complete months without passing the end date.
- 3. Count the remaining days from the final reference date to the end date.
- 4. Calculate total days separately and compare it with the calendar-unit display.
| Step | Reference date | Check |
|---|---|---|
| Complete years | The original start date | Start plus the years must not pass the end date |
| Complete months | The date after complete years | Use a month-end rule if the same day does not exist |
| Remainder days | The date after complete years and months | Count the days left to the end date |
| Audit | The original start and end dates | Compare the date difference and total-day result |
Handle dates that cross a month end
Month ends are the most common boundary in a years-months-days calculation because the same day number may not exist in the next month. January 31 to February 28 or February 29 cannot be converted reliably by dividing the total by 30. The complete-month result depends on how the missing anniversary date is treated.
Common approaches move a missing anniversary to the last day of the target month, or leave the difference as days after the last valid month boundary. Neither convention is universal. The calculator and this article provide a general calendar reference, while a contract, payroll rule, or statutory procedure may prescribe a specific anniversary convention.
For a month-end input, save the two dates, the total days, and a short note about the convention. Two records can have the same total days but different years-months-days labels if their unit rules differ. A note lets another person reproduce the result instead of guessing why it changed.
- Treat a start date such as January 31 or March 31 as a special anniversary case.
- February has 28 days in a common year and 29 in a leap year.
- Do not confuse a 30-day estimate with complete calendar months.
| Input example | Boundary to check | How to document it |
|---|---|---|
| 2025-01-31 to 2025-02-28 | The next month has no day 31 | State the month-end or remainder-day rule |
| 2024-01-31 to 2024-02-29 | Leap-year February end | Store total days beside the calendar result |
| 2026-03-30 to 2026-04-30 | The same day exists at month end | Recheck whether this is one complete month |
| 2026-03-31 to 2026-04-30 | The end date is a month end | Confirm the applicable anniversary definition |
Check leap years and February 29
A year is normally a leap year when it is divisible by 4. A year divisible by 100 is a common year unless it is also divisible by 400. Thus 2024 has 366 days, 2100 has 365 days, and 2000 has 366 days. If February 29 falls inside the interval, it affects total days and can affect the final remainder.
Consider February 29, 2024 to February 28, 2025. The next year has no February 29, so the complete-year point is not an ordinary matching month and day. Some systems use the last day of February as the anniversary; others expose the remaining days. Use the rule of the relevant system or document rather than treating the screen result as a legal definition.
You do not need to count every date manually to audit a leap-year result. Check the year rule, confirm whether the interval includes February 29, and compare the total-day formula with the calculator. If the calendar display and total days look inconsistent, review endpoint inclusion and month-end handling in that order.
- Check whether the year is divisible by 4.
- For a year divisible by 100, also check whether it is divisible by 400.
- When February 29 is an endpoint, confirm the anniversary date in the following year.
| Year | Decision | Days |
|---|---|---|
| 2024 | Divisible by 4 and not by 100 | 366 days |
| 2100 | Divisible by 100 but not by 400 | 365 days |
| 2000 | Divisible by 400 | 366 days |
Verify the result with Excel DATEDIF
To reproduce a years-months-days result in Excel, put the start date in A2 and the end date in B2. DATEDIF uses Y for complete years, YM for months left after complete years, and MD for days left after complete months. Joining the three values creates a readable period, while a separate total-day cell provides an audit trail.
A formula such as =DATEDIF(A2,B2,"Y")&" years, "&DATEDIF(A2,B2,"YM")&" months, "&DATEDIF(A2,B2,"MD")&" days" joins the units. The MD unit can behave unexpectedly for some date combinations. Microsoft documents known limitations, so do not treat MD as the only evidence for a month-end result.
For a total-day check, use =B2-A2 or =DAYS(B2,A2) in another cell. If the workflow includes the start date, apply the same endpoint rule in Excel and in the article or calculator. A formula that is correct under one rule can be one day off under another.
Replace B2 with TODAY() only when a moving result is intended. TODAY changes when Excel recalculates, so a report or proof should use a fixed reference date and record the calculation date.
- Y: complete years.
- YM: remaining months after complete years.
- MD: remaining days after years and months; verify month-end cases.
- DAYS or subtraction: a separate total-day check for the calendar display.
| Purpose | Example formula | Check |
|---|---|---|
| Complete years | =DATEDIF(A2,B2,"Y") | The end date is not passed |
| Remaining months | =DATEDIF(A2,B2,"YM") | Months after complete years |
| Remaining days | =DATEDIF(A2,B2,"MD") | Known month-end limitations |
| Total days | =B2-A2 | Decide endpoint inclusion separately |
Examples for tenure, age, and contract periods
For employment tenure, use the hire date as the start date and the reference or leaving date as the end date. A period from April 1, 2020 to March 31, 2026 may be described as six complete years under an anniversary rule, while an inclusive attendance total is a different measure. Follow the employer's payroll or separation policy.
For age, the birthday is the key anniversary. A person's complete age changes on the birthday, not simply after dividing total days by 365. If you add months and days to an age display, write the reference date beside it. Official age requirements may use a statutory reference date instead of this general calendar calculation.
Contract periods can define times of day, holidays, renewal moments, and whether the final day is available. A date-only years-months-days result is useful for organizing the contract, but it does not replace the expiry definition in the contract or a professional interpretation.
- Save the two input dates with the displayed result.
- Label the output as an elapsed period or a counted usage period.
- Add a note for month end, a leap year, or a special reference date.
| Use case | Start date | End or reference date | Record example |
|---|---|---|---|
| Employment tenure | Hire date | Leaving date or report date | Years, months, days plus total days |
| Age | Date of birth | Reference date | Complete age and reference date |
| Contract period | Contract start | Contract end | Follow the contract's definition |
Check the result with the date calculator
After checking the endpoint rule by hand or in Excel, enter the start and end dates in the years, months, and days calculator. It shows complete years, remaining months, remaining days, complete months, and total days together, so you can compare the readable period with the numeric difference.
If the dates are reversed, the tool may normalize their order. Confirm the normalized order before sharing the result. Switching between elapsed and inclusive reference values can change the answer by one day even when the two input dates stay the same. Include the chosen rule and reference date in any report.
Use the date difference calculator when only total days matter, and read the Excel date difference formulas guide when you need to compare DAYS, DATEDIF, or NETWORKDAYS. Separating those tasks prevents a calendar period from being confused with a business-day count.
- Enter the start and end dates and choose elapsed or inclusive treatment.
- Review the calendar-unit display and total days together.
- Read the note for month end, February 29, or reversed input.
- For important procedures, compare the result with the official definition.
Enter dates to review the calendar period
Compare years, months, days, complete months, and total days on one screen after entering a start date and an end date.
Open the years, months, and days calculator →Summary: choose the endpoints, then compare calendar units and total days
To calculate years months days between dates, split the interval into complete years, complete months, and remaining days on the calendar instead of dividing by average month lengths. Decide endpoint inclusion, month-end treatment, and leap-year handling before you write down the result.
When the rule is unclear, show both the calendar period and total days, and save the input dates with the convention used. Use the calculator for a quick check, the date difference page for total days, and the Excel date calculator for spreadsheet verification.
Frequently asked questions
How do I calculate years, months, and days between two dates?
Find complete years first, then complete remaining months, and finally the leftover days from the updated reference date. Use the actual calendar dates instead of dividing by an average 365-day year or 30-day month.
Are both the start date and end date included?
A standard elapsed difference treats identical dates as 0 days. A usage or covered-day count may include both endpoints and return 1 day. State the rule in the result and follow the applicable policy.
How many months are January 31 to February 28?
The answer depends on the month-end convention. One method treats February 28 as the anniversary and counts one complete month; another keeps a remainder in days. Check the contract or policy and record total days as well.
Does a leap year change the result?
Yes. A February 29 adds a day to the calendar interval and can change the remainder when February 29 is an endpoint. Review the leap-year rule and the following year's anniversary convention.
Can Excel show the same years-months-days result?
Yes. Combine DATEDIF with Y, YM, and MD units to return complete years, remaining months, and remaining days. Because MD has known limitations for some combinations, verify the total days with B2-A2 or DAYS.
Can I use this to display age in years, months, and days?
Enter the birth date as the start date and a chosen reference date as the end date for a general calendar display. Official age requirements may use a statutory reference date, so follow that rule for an application or eligibility decision.
Should I use total days or years, months, and days?
Use total days for a deadline or day limit, and calendar units for explaining age or tenure. If a report needs both, apply one endpoint rule consistently and show both values.
Can I use the article or calculator to decide a contract date?
Use the calculation as a general calendar reference. For a contract, employment, insurance, leave, or filing deadline, the contract, regulation, official guidance, and responsible office take priority over a generic date difference.
Official references
Microsoft's support pages are useful when you need to verify function arguments or known date-unit behavior.