The years between two dates calculator turns any pair of calendar dates into a decimal number of years. It is a quick way to measure an elapsed span, check someone's age from two dates, or compare how long ago a past year was, without counting the days by hand.
To find the years between two dates, subtract the start date from the end date to get the day count, add one day if you want the end date included, then divide by 365.25. The calculator does this automatically: enter the From and To dates and it returns the span as a decimal number of years, with a unit switcher for months, weeks, or days.
What formula converts a date span into years?
The calculator applies two equations in sequence. First it finds the time between the two dates, then it converts that day count into years:
The 365.25 divisor is the average length of a year in days. It accounts for the extra quarter-day that builds up each year and is returned as a leap day every four years, so the decimal result stays close to the true elapsed time across leap years.
| Symbol | Calculator field | What it holds |
|---|---|---|
| date1 | From | The start date you enter |
| date2 | To | The end date you enter |
| include end date | Include end date? checkbox | Option value 0 when unchecked, 1 when checked |
| time between | Time between | The day count between the two dates |
| years between | Years between (yrs) | The day count divided by 365.25 |
How do I use the years between two dates calculator?
- Enter a start date in the From field, choosing a date from the calendar or typing it in.
- Enter the date you want to end on in the To field.
- Read the length of time between the two dates as a decimal number in the Years between field.
- Change the output to other time units, such as months, weeks, and days, if a different unit suits your question.
By default the end date is not taken into account, so the result includes the start date but stops before the end date. To count it, check the Include end date? option, which switches its value from 0 to 1 and adds one day to the span.
Worked example: January 2020 to July 2022
Take the span from January 1, 2020 to July 11, 2022. Counting the days on the calendar gives 922 days, including one February 29 in the leap year. That day count is the time between the two dates.
Dividing by the average year length:
So the two dates are about 2.524 years apart. With the Include end date? option switched on, one more day joins the time-between count and the reported number of years rises slightly.
Frequently Asked Questions
Does the calculator count the end date by default?
No. The Years between result includes the start date and excludes the end date until you tick Include end date?, which changes the option from 0 to 1.
Can I show the result in months, weeks, or days?
Yes. The variable unit switcher displays the same date span in months, weeks, or days instead of decimal years.
Are leap days counted in the year total?
Yes. Include 29 February in the day count, as the worked example does with the leap day between January 2020 and July 2022, before dividing by 365.25.
References
- Omni Calculator, "Years Between Two Dates": calculator equations, inputs and worked example.
- Standard calendar references on the 365.25-day average year and the four-year leap-day rule.
- General unit-conversion references for time spans expressed in years, months, weeks and days.