Guides

How to Calculate Years Between Two Dates

Calculate years between two dates with the 365.25-day formula, a four-step calculator walkthrough, the include-end-date rule, and a 922-day worked example.

Miryori Editorial Team3 min read
Try the Years Between Two Dates Calculator

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:

time between=date2−date1+include end date,years between=time between365.25\text{time between} = \text{date2} - \text{date1} + \text{include end date}, \qquad \text{years between} = \frac{\text{time between}}{365.25}

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?

  1. Enter a start date in the From field, choosing a date from the calendar or typing it in.
  2. Enter the date you want to end on in the To field.
  3. Read the length of time between the two dates as a decimal number in the Years between field.
  4. 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:

years between=922 days365.25 days per year=2.524 years\text{years between} = \frac{922\ \text{days}}{365.25\ \text{days per year}} = 2.524\ \text{years}

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.
Calculator

Years Between Two Dates Calculator

Years Between Two Dates: find the number of years between two dates with the years between two dates calculator. Free, fast and private.

Try the Years Between Two Dates Calculator