"How many years apart are we?" sounds like a one-step subtraction, and for a rough answer it is. But the precise age difference between two people — or the exact duration between any two dates — needs the same careful calendar arithmetic that age itself does. Get it slightly wrong and you are off by a year right around a birthday, or by a day right around a month boundary.
This guide covers two closely related calculations: the age gap between two people and the duration between two arbitrary dates. The method is the same; only the inputs differ.
Age Gap vs. Date Difference
They sound identical, and mechanically they are — both measure the span between two calendar dates. The distinction is just what the dates represent:
- Age gap: the two dates are two people's birth dates. The result tells you how much older one person is than the other, and it never changes.
- Date difference: the two dates are any events — a start and end, an anniversary, a deadline, a visa window. The result is the duration between them.
Because the underlying math is shared, learn it once and both problems are solved.
The Method
Take the earlier date and the later date. (If you are not sure which is which, compute both and the calculation will tell you — a negative result means you had them backwards.)
Subtract year, month, and day separately, then borrow when a result goes negative:
years = later.year − earlier.year
months = later.month − earlier.month
days = later.day − earlier.day
if days < 0:
days += days_in(previous month of 'later')
months -= 1
if months < 0:
months += 12
years -= 1
That yields the gap in years, months, and days. To express it purely in days, convert each date to a serial day number and subtract.
Worked Example: Age Gap Between Two People
Person A born 1988-07-30, Person B born 1992-03-14. A is older, so A's date is the earlier one.
years = 1992 − 1988 = 4
months = 3 − 7 = -4 ← negative
days = 14 − 30 = -16 ← negative, fix first
Borrow days. The month before March is February; 1992 was a leap year, so February had 29 days:
days = -16 + 29 = 13
months = -4 - 1 = -5
Months still negative, borrow a year:
months = -5 + 12 = 7
years = 4 - 1 = 3
Age gap = 3 years, 7 months, 13 days. Person A is that much older than Person B — and notice the leap-year detail (using 29 instead of 28) changed the day result. Miss it and you would report 12 days.
Worked Example: Duration Between Two Dates
A project ran from 2024-11-05 to 2026-06-01.
years = 2026 − 2024 = 2
months = 6 − 11 = -5 ← negative
days = 1 − 5 = -4 ← negative, fix first
Borrow days. The month before June is May (31 days):
days = -4 + 31 = 27
months = -5 - 1 = -6
Borrow a year:
months = -6 + 12 = 6
years = 2 - 1 = 1
Duration = 1 year, 6 months, 27 days.
Common Mistakes
1. Inclusive vs. exclusive day counts
Is the span from Monday to Wednesday two days or three? It depends on whether you count both endpoints. Subtracting serial numbers gives the exclusive count (2). If you need to count both the first and last day — common for hotel nights, rental periods, or event durations — add one. Decide which you mean before you calculate.
2. Forgetting leap years in the borrow
When you borrow days across February, you must use 29 days in a leap year and 28 otherwise. This is the single most common source of off-by-one-day errors in age-gap math, as the example above showed.
3. Confusing "years apart" with calendar years
Two people born in 2000 and 2003 are not automatically "3 years apart." If one was born in January and the other in December, the real gap could be closer to 2 years or nearly 4. Only the full date tells you.
4. Ignoring direction
An age gap is usually stated as a positive number, but if your tool returns a negative span you simply swapped the earlier and later dates. The magnitude is still correct.
A Faster Way
For a quick, exact result without any borrowing by hand, use the age between two dates tool — enter both dates and read the gap in years, months, and days. If you are measuring a generic duration rather than an age gap, the date difference calculator gives the same span plus the total in days, weeks, and months. And to find one person's exact age on a specific reference date, the age calculator by date handles any past or future day.
Quick Reference
| You want… | Use |
|---|---|
| Age gap between two people | Both birth dates, earlier first |
| Duration of an event/project | Start and end dates |
| Gap in pure days | Subtract serial day numbers |
| Count both endpoints | Add 1 to the day difference |
| Cross a February | Use 29 days in leap years, 28 otherwise |
FAQ
How do I calculate the age difference between two people?
Use both birth dates, putting the earlier one first, and subtract the years, months, and days separately. Borrow days from the previous month and months from the year whenever a result goes negative. The final figure is how much older one person is than the other, and it never changes over time.
What is the difference between an age gap and a date difference?
None mathematically — both measure the span between two calendar dates. An age gap simply uses two people's birth dates, while a date difference uses any two events such as a start and end date. The same subtract-and-borrow method solves both.
Should I count both the start and end date?
That depends on your purpose. Subtracting serial day numbers gives an exclusive count (it does not include the final day). For hotel nights, rentals, or event lengths where both endpoints count, add one to the result. Decide which convention you need before calculating.
Why does a leap year change my age-gap result?
When you borrow days across February, the month length matters: 29 days in a leap year versus 28 otherwise. Using the wrong length shifts the day portion of the gap by one, which is the most common off-by-one error in this kind of math.
Can the age difference be negative?
Only if you entered the later date first. The magnitude is still correct — just swap the two dates, or read the result as "the other person is older by that amount."
Is there a tool that does this automatically?
Yes. The age between two dates tool returns the gap in years, months, and days, and the date difference calculator adds totals in days, weeks, and months — both with leap years handled for you.