# How many years between two dates?

Counts how many years are between two dates: whole years, months, and days, the same span as a decimal number of years, and the total months and days.

- Page: https://www.acalculator.org/days/years-calculator
- JSON spec: https://www.acalculator.org/days/years-calculator.json
- Version: 964aa5b82a19

## Default answer

Example with the default inputs (Start date January 1, 2000, End date September 30, 2026) on the example date Wednesday, September 30, 2026: From January 1, 2000 to September 30, 2026 is 26 years, 8 months, 29 days, or 26.75 years.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| start | Start date | The earlier date. |
| end | End date | The later date. Today, unless you change it. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| span | Time between | Whole years, then whole months, then days from the start date to the end date. |
| years | In years | Whole years plus the part of the next year that has passed: the days since the last anniversary ÷ the days in that anniversary year. |
| months | Whole months | The number of whole calendar months from the start date to the end date. |
| days | Days | Calendar days from the start date to the end date. |

## Method

years = the most whole years Y with start + Y years ≤ end, then months and days; decimal years = Y + (end − (start + Y years)) ÷ ((start + (Y + 1) years) − (start + Y years))

## Assumptions

- Dates are whole calendar days in the Gregorian calendar, with no time of day.
- An anniversary of February 29 falls on February 28 in a common year; a day that a month does not have moves to its last day.
- The decimal part is the days since the last anniversary divided by the days (365 or 366) until the next one.
- The end date is today unless you change it; the page reads today’s date from your device when it loads.
- A start date after the end date has no answer.

## Worked examples

1. start = 2000-01-01, end = 2026-09-30 gives span = {"years":26,"months":8,"days":29}, years = 26.745205, months = 320, days = 9,769. Source: Julian Day numbers (Meeus, Astronomical Algorithms, 1991, chapter 7): JD 2461313.5 − JD 2451544.5 = 9769 days.
2. start = 1990-07-15, end = 2026-03-10 gives span = {"years":35,"months":7,"days":23}, years = 35.652055, months = 427, days = 13,022.
3. start = 2020-02-29, end = 2021-02-28 gives span = {"years":1,"months":0,"days":0}, years = 1, months = 12, days = 365. Source: Gregorian leap-year rule (ISO 8601).
4. start = 2024-02-29, end = 2028-02-28 gives span = {"years":3,"months":11,"days":30}, years = 3.997268, days = 1,460. Source: Gregorian leap-year rule (ISO 8601).

## FAQ

### How do I work out how many years are between two dates?

Count the whole years first: the most anniversaries of the start date that are not after the end date. Then count whole months, then the days left. From January 1, 2000 to September 30, 2026 is 26 years, 8 months, and 29 days.

### How is the decimal number of years found?

It is the whole years plus the part of the next year that has passed. From January 1, 2000 to September 30, 2026: the last anniversary is January 1, 2026, 272 days earlier, and the next is 365 days after it, so the answer is 26 + 272 ÷ 365 = 26.75 years.

### Why not just divide the days by 365.25?

Because that gives a fraction of an average year, not of the real year. Dividing by the days in the actual anniversary year means a whole number of years always comes out whole: exactly 10 years after a date is 10.00 years, never 9.99 or 10.01.

### What happens with a February 29 start date?

In a common year the anniversary falls on February 28. So February 29, 2020 to February 28, 2021 is exactly 1 year. When the later year is a leap year, the anniversary is February 29 itself.

### How many years ago was a date?

Leave the end date as today and enter the date as the start date. The page reads today’s date from your device when it loads, so the answer is right on the day you open it.

### Does the order of the dates matter?

Yes. The start date must be on or before the end date; otherwise there is no answer. Swap the two dates.

## Sources

- Jean Meeus, Astronomical Algorithms (1991), chapter 7: Julian Day numbers, so the days between two dates are the difference of their Julian Days.
- ISO 8601, Date and time format: the Gregorian calendar and its leap-year rule.
