What this calculator does
This Age in Years, Months, and Days Calculator measures the exact elapsed time between a birth date (or any start date) and a chosen as-of date. Instead of returning a single decimal number, it decomposes the difference into whole years, whole months, and remaining days — the same way people naturally describe age, such as "32 years, 4 months, and 18 days."
How to use it
Enter the birth date as separate year, month, and day values, then enter the as-of date (defaulting to today). Click calculate and the result shows the breakdown. The as-of date should normally be on or after the birth date.
The formula explained
The calculation starts by subtracting each component: years = \(Y_2 - Y_1\), months = \(M_2 - M_1\), days = \(D_2 - D_1\). Because months have different lengths and years can be leap years, two "borrow" steps fix any negatives. If the day count is negative, we add the number of days in the month preceding the as-of date and subtract one from the month count. If the month count is then negative, we add 12 and subtract one from the year count. Leap years (divisible by 4, but not 100 unless also divisible by 400) are respected so February is counted as 28 or 29 days correctly.
$$\text{Age} = (Y_2 - Y_1)\ \text{years},\ (M_2 - M_1)\ \text{months},\ (D_2 - D_1)\ \text{days (with borrow)}$$
$$D = D_2 - D_1 + \text{daysInPrevMonth},\quad M = M - 1$$
$$M = M_2 - M_1 + 12,\quad Y = Y - 1$$
Worked example
Birth date 2000-01-15, as-of date 2024-03-10. Days: \(10 - 15 = -5\), so borrow February 2024 (a leap year = 29 days): \(10 - 15 + 29 = 24\) days, and months drops by 1. Months: \(3 - 1 - 1 = 1\). Years: \(2024 - 2000 = 24\). Result: 24 years, 1 month, 24 days.
Key Terms Explained
- Birth date
- The earlier of the two dates — the day the person (or item) began. In the formula it supplies the birthYear, birthMonth, and birthDay values that are subtracted from the as-of date.
- As-of date
- The reference date you are measuring up to (often today). It supplies toYear, toMonth, and toDay. The age is how much time has elapsed from the birth date up to and including this point.
- Leap year
- A year containing 366 days, with February 29 added. In the Gregorian calendar a year is a leap year if it is divisible by 4, except century years, which must also be divisible by 400 (so 2000 was a leap year but 1900 was not). Leap years affect day counts whenever February 29 falls inside the interval.
- Calendar borrowing
- The adjustment that keeps the result non-negative. If the day difference \(D<0\), you borrow one month: add the number of days in the previous month to \(D\) and reduce \(M\) by 1. If the month difference \(M<0\), you borrow one year: add 12 to \(M\) and reduce \(Y\) by 1. This mirrors borrowing in ordinary subtraction.
- daysInPrevMonth
- The length (28, 29, 30, or 31 days) of the calendar month immediately before the as-of month — the value added to \(D\) during a day borrow. Because month lengths vary, the exact number of days that “completes” a partial month is not fixed, which is why an age in days cannot be derived from years and months alone.
- Elapsed months vs. decimal years
- Elapsed months count whole calendar months actually completed (e.g. 18 months), preserving real month boundaries. A decimal year divides total days by an average year length (e.g. 365.25) to give a figure like 1.52 years. Decimal years are convenient for averaging but lose the exact calendar structure; the (years, months, days) breakdown is precise to the actual calendar.
FAQ
Does it handle leap years? Yes — February length and borrowing use full leap-year rules.
What if the as-of date is before the birth date? Results may be negative; for a meaningful age, keep the as-of date on or after the birth date.
Why split into years, months, and days? It mirrors how age is commonly stated and is more intuitive than a single decimal year value.