Everyday Math 9 Min Read

How to Calculate Age from Date of Birth: Manual & Algorithmic Guide

Calculating your exact age sounds simple, but calendar irregularities like leap years and variable month lengths make manual date subtraction tricky. Learn the exact borrowing math step by step.

ACN

AllCalcNow Editorial Team

Published June 27, 2026

When someone asks how old you are, your immediate response is typically a single number representing your age in years. However, in many contexts—such as tracking a baby's developmental milestones, calculating legal eligibility, filling out medical paperwork, or developing software applications—you need to know the exact age down to the year, month, and day.

While we rely on digital calendars and smart devices to track dates for us, understanding the mathematical principles behind date calculations is a valuable skill. Because months vary in length (28, 29, 30, or 31 days) and years periodically add a leap day, standard subtraction doesn't work like normal decimal arithmetic. In this guide, we explore the manual date subtraction formula, establish the "borrowing" rules for variable calendar months, walk through worked examples, and explain how databases compute exact ages.

The Manual Date Subtraction Formula

To calculate an age manually, we arrange the target dates vertically in `YYYY-MM-DD` order: the current date (or end date) goes on top, and the date of birth goes underneath. We then subtract from right to left, starting with days, moving to months, and finishing with years.

The challenge arises when the number in the top row is smaller than the number in the bottom row. Just as in regular base-10 subtraction, we must "borrow" from the column to the left. However, date columns use different bases:

  • Borrowing Days from Months: When the current day is less than the birth day, we borrow 1 month from the month column. We reduce the month count by 1 and add the number of days in the *previous* month (the month immediately preceding the target month) to the current day.
  • Borrowing Months from Years: When the current month is less than the birth month, we borrow 1 year from the year column. We reduce the year count by 1 and add exactly 12 months to the month column.

Calculate Your Age Instantly

Avoid the calendar borrowing math. Enter your date of birth in our free, interactive Age Calculator to see your age in years, months, days, weeks, and hours instantly.

Step-by-Step Calculation Examples

Let's work through two detailed subtraction examples to demonstrate both simple subtraction and borrowing arithmetic.

Example 1: Subtraction Without Borrowing

A person was born on April 12, 1995. We want to calculate their exact age as of June 22, 2026.

  Target Date:  2026 Year - 06 Month - 22 Day
  Birth Date:  - 1995 Year - 04 Month - 12 Day
  -------------------------------------------
  Difference:     31 Year - 02 Month - 10 Day
        
  • Subtract Days: `22 - 12 = 10` days.
  • Subtract Months: `6 - 4 = 2` months.
  • Subtract Years: `2026 - 1995 = 31` years.

As of June 22, 2026, this individual is exactly 31 years, 2 months, and 10 days old.

Example 2: Complex Subtraction with Borrowing

A baby was born on October 28, 2025. We want to calculate their exact age as of June 22, 2026.

  Target Date:  2026 Year - 06 Month - 22 Day
  Birth Date:  - 2025 Year - 10 Month - 28 Day
        

Here is the step-by-step resolution of the borrowing arithmetic:

  • Step 1: Subtraction of Days (22 - 28)
    Since 22 is smaller than 28, we must borrow from the month column. We borrow 1 month from June (reducing the Month column from 06 to 05). The month immediately preceding June is May, which has 31 days. We add 31 to our day column:
    New Day Column = 22 + 31 = 53 days
    Now we subtract: 53 - 28 = 25 days.
  • Step 2: Subtraction of Months (5 - 10)
    Our Month column is now 5. Since 5 is smaller than 10, we must borrow 1 year from the Year column. We reduce the Year column from 2026 to 2025 and add 12 months to the Month column:
    New Month Column = 5 + 12 = 17 months
    Now we subtract: 17 - 10 = 7 months.
  • Step 3: Subtraction of Years (2025 - 2025)
    Our Year column is now 2025. We subtract: 2025 - 2025 = 0 years.

As of June 22, 2026, the baby is exactly 0 years, 7 months, and 25 days old.

The Leap Year and Date Pitfalls

When calculating dates manually or writing code routines, keep these essential cases in mind:

  1. The February 29th Problem: Individuals born on a leap day (February 29) face legal definitions of their age during non-leap years. In many countries, a person legally turns a year older on March 1, while other jurisdictions recognize February 28.
  2. Varying Month Lengths: Borrowing requires checking the calendar. If you are calculating in July (Month 7), borrowing 1 month means pulling from June (Month 6), which has 30 days. If you are calculating in March, borrowing 1 month pulls from February (which has 28 days, or 29 in a leap year).
  3. Time Zones: A person's exact date of birth is tied to the time zone where they were born. If a person was born on June 22 at 2:00 AM in London, it was still June 21 at 9:00 PM in New York, which can shift the day calculation if local time zones are ignored in digital databases.

By checking the calendar borrowing rules and accounting for leap days, you can accurately track age milestones and build solid logic for software tools.

Frequently Asked Questions

How do you calculate age manually?

You stack the current date (Year-Month-Day) above the birth date and subtract from right to left (Days, then Months, then Years). If a value is negative, borrow 30–31 days from the month column, or 12 months from the year column.

Does my age change on the exact hour of birth?

Legally, your age increments at midnight on the morning of your birthday, regardless of the specific hour of your birth.

How do databases calculate age?

Databases typically convert calendars to absolute timestamps or use built-in functions. For example, PostgreSQL uses the `AGE(timestamp1, timestamp2)` function, while JavaScript relies on subtracting epoch millisecond values and dividing by milliseconds per year, adjusting for leap years.