Using Our Tools · Guide · Productivity
How to calculate age between two dates
Y/M/D decomposition, leap year handling, inclusive vs exclusive day counts, pregnancy weeks convention, legal age variance by purpose, biological vs chronological age, and pet age conversions.
Calculating age between two dates sounds simple — subtract the years — but the edge cases matter. Leap years, inclusive versus exclusive counts, whether “23 years old” means completed years or the current year of life, legal age jurisdictions that differ by purpose, pregnancy counted in weeks versus months. This guide walks through the math, the conventions you’ll run into, and where the gotchas actually bite.
Advertisement
The Y/M/D decomposition
The standard way to express age between two dates: years, months, days — the largest unit first, carrying down from each level.
Algorithm:
1. Years = endYear − startYear. If end’s (month, day) is earlier in the year than start’s, subtract 1 (the last birthday hasn’t happened yet).
2. Months = endMonth − startMonth (mod 12 if negative), adjusting year if needed.
3. Days = endDay − startDay. If negative, borrow from the previous month’s day count (and decrement months by 1).
Example: start 1990-03-15, end 2026-04-23 → Years = 36, Months = 1, Days = 8. (March 15 1990 → March 15 2026 = 36 years; + 1 month + 8 days to reach April 23 2026.)
Leap years — the February 29 trap
Leap year: divisible by 4, except century years unless divisible by 400. So 2000 was a leap year, 1900 was not, 2100 will not be.
Someone born February 29, 2000: when exactly do they turn 25? Legally (most jurisdictions) on March 1, 2025 (non-leap years). In leap years (2024, 2028), they turn on the 29th. Software that doesn’t handle this returns “March 1” or crashes on Feb 29 inputs.
Day-count math across leap years: if spans include Feb 29, that day counts normally — ~365.25 days per year average.
Inclusive vs exclusive day count
Asked “how many days from March 15 to March 20”, two valid answers:
Exclusive: 20 − 15 = 5 days. Used in most date math (duration between two timestamps).
Inclusive: 20 − 15 + 1 = 6 days. Used when counting calendar days a person is present or active (hotel stays, hospital admissions, “trip lasted X days”).
Ambiguous in conversation; context determines convention. Legal and medical often prefer inclusive; financial/duration math prefers exclusive.
Age in years — completed vs current year of life
In Western countries: “23 years old” = completed 23 years since birth. You turn 24 on your 24th birthday.
In traditional Korean / East Asian age counting (being phased out but historically used): you’re 1 at birth and gain a year each New Year. A baby born December 31 becomes “2 years old” the next day. South Korea officially standardized on Western counting in 2023 but cultural usage lingers.
In Chinese traditional counting (“virtual age”, xūsuì): similar to Korean — 1 at birth, +1 at each lunar new year.
Computation-wise: always use completed years for software and legal contexts unless explicitly told otherwise.
Pregnancy — weeks and months conventions
Pregnancy is counted in weeks from the last menstrual period (LMP), not conception. A “9-month” pregnancy is actually 40 weeks = ~10 lunar months or ~9 calendar months.
Trimesters:
First: weeks 1–12.
Second: weeks 13–27.
Third: weeks 28–40.
Due date = LMP + 280 days (40 weeks). Naegele’s rule: LMP + 1 year − 3 months + 7 days.
After birth, baby age is in weeks for the first ~3 months, then months until ~2 years, then years. Developmental milestones are tied to these conventions.
Legal age — varies by purpose and jurisdiction
One person, multiple “legal ages”:
Drinking (US): 21 (federal minimum).
Drinking (UK / most of EU): 18 (some countries 16 for beer/wine).
Driving (US): 16 typical (varies by state, some 14 or 15 with restrictions).
Driving (EU): 18 typical, 17 with accompaniment in some countries.
Voting: 18 nearly everywhere; 16 in Austria, Scotland (some elections), Brazil (optional).
Contract signing (majority): 18 in most Western jurisdictions, 21 in a few.
Criminal responsibility: varies widely — 10 (UK), 12 (many EU), 14 (Germany, Japan, China).
Retirement age: 65–67 standard in OECD, rising; varies by country and birth year.
Biological vs chronological age
Chronological: time since birth. What a birthday measures.
Biological age: a measure of physiological aging, typically derived from biomarkers (DNA methylation “epigenetic clocks” like Horvath, PhenoAge, GrimAge). Can differ from chronological by 10+ years.
Biological age is the variable research has tied to mortality and disease risk. Chronological just correlates with it on average. For medical decisions, biological is increasingly relevant — for legal ones, chronological is what matters.
Pet age conversions — beyond “dog years”
The old “dog years = human years × 7” rule is wrong. Better approximation (AVMA and research-based):
Dogs: Year 1 ≈ 15 human years. Year 2 ≈ +9 (total 24). After that +4–5 per dog year. Large breeds age faster than small.
Newer epigenetic model: human_age = 16 × ln(dog_age) + 31. A 10-year-old dog ≈ 68 human years by this model.
Cats: Year 1 ≈ 15 human years, Year 2 ≈ +9 (total 24), then +4 per year. A 10-year-old cat ≈ 56 human years.
Business-date arithmetic
If the question is about working days (not calendar days), skip weekends and holidays:
Weekends: ~5/7 of all days are weekdays. 30 calendar days ≈ 21–22 working days.
Holidays: US has ~10 federal; UK has 8 bank holidays; each country differs. Annual holidays per country vary from ~6 (US) to ~15 (Japan).
When giving deadlines in business contexts, be explicit: “10 business days” vs “2 weeks” can differ by 4+ calendar days.
Time zones — when the dates differ by zone
“Born November 30” in Tokyo = “November 29” in New York. When calculating age across time zones, pick a convention: birth date in birth locale (most common), or UTC (rarely needed outside software). Be consistent to avoid off-by-one bugs.
Common calculation errors
Error 1: Forgetting to subtract a year when the end date’s birthday hasn’t occurred yet. Someone born June 15 1990, on April 23 2026, is 35 — not 36, because June 15 2026 hasn’t happened.
Error 2: Using 365.25 or 365 days per year uniformly. Accurate for rough age estimates, loses precision on exact day counts.
Error 3: Off-by-one in inclusive counts. “From Monday to Friday” — 4 days (exclusive) or 5 (inclusive)?
Error 4: Software using 32-bit date types silently wraps around 2038 or fails before 1970. Use proper date libraries.
Run the numbers
Compute age between two dates down to days with the age calculator. Pair with the countdown timer for counting down to a future date, and the pregnancy calculator if you’re working with LMP-based pregnancy math.
Advertisement