{
  "id": "dob",
  "version": "c00d50094740",
  "status": "published",
  "name": "DOB Calculator",
  "question": "How old am I from my DOB?",
  "summary": "Works out an exact age in years, months, and days from a date of birth (DOB), on today or any date, with the total days and the next birthday.",
  "category": "days",
  "subcategory": "age",
  "url": "https://www.acalculator.org/days/dob-calculator",
  "markdown": "https://www.acalculator.org/days/dob-calculator.md",
  "kind": "function",
  "method": "Count whole years from the date of birth while the birthday is on or before the age-on date, then whole months the same way, then the days left.",
  "assumptions": [
    "A month is counted when the same day of the month is reached; when that month is shorter, its last day counts (January 31 plus one month is February 28, or 29 in a leap year).",
    "A February 29 birthday falls on February 28 in common years.",
    "Total days count from the date of birth up to the age-on date, the birth day itself not included, so a baby is 1 day old the day after birth.",
    "Dates are calendar days with no time of day or time zone, so daylight-saving changes cannot add or lose a day.",
    "A date of birth after the age-on date gives no answer."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "birth": {
        "title": "Date of birth",
        "description": "The day the person was born.",
        "type": "string",
        "format": "date"
      },
      "on": {
        "title": "Age on",
        "description": "The date to work out the age on. Today, unless you change it.",
        "type": "string",
        "format": "date"
      },
      "name": {
        "title": "Name",
        "description": "A name to use in the answer, for example your child’s name.",
        "type": "string",
        "maxLength": 60
      }
    }
  },
  "outputs": {
    "age": {
      "label": "Age",
      "description": "Whole years, then whole months, then days from the date of birth to the age-on date.",
      "format": "duration"
    },
    "who": {
      "label": "Who",
      "description": "The name you entered, or “You”.",
      "format": "text"
    },
    "years": {
      "label": "Age in years",
      "description": "Completed years (birthdays passed).",
      "format": "integer"
    },
    "months": {
      "label": "Total months",
      "description": "Completed months since birth.",
      "format": "integer"
    },
    "weeks": {
      "label": "Total weeks",
      "description": "The total days as whole weeks and days.",
      "format": "duration"
    },
    "days": {
      "label": "Total days",
      "description": "Days from the date of birth to the age-on date.",
      "format": "integer"
    },
    "bornOn": {
      "label": "Born on a",
      "description": "The weekday of the date of birth.",
      "format": "text"
    },
    "next": {
      "label": "Next birthday",
      "description": "The first birthday after the age-on date. A February 29 birthday is February 28 in other years.",
      "format": "date-long"
    },
    "daysToNext": {
      "label": "Days to next birthday",
      "description": "Days from the age-on date to the next birthday.",
      "format": "integer"
    },
    "turns": {
      "label": "Turns",
      "description": "The age in years on the next birthday.",
      "format": "integer"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "birth": "2002-02-02",
      "on": "2026-10-05"
    },
    "outputs": {
      "age": {
        "years": 24,
        "months": 8,
        "days": 3
      },
      "who": "You",
      "years": 24,
      "months": 296,
      "weeks": {
        "weeks": 1287,
        "days": 2
      },
      "days": 9011,
      "bornOn": "Saturday",
      "next": "2027-02-02",
      "daysToNext": 120,
      "turns": 25
    },
    "text": "You: 24 years, 8 months, 3 days old on October 5, 2026."
  },
  "examples": [
    {
      "given": {
        "birth": "1990-01-15",
        "on": "2024-12-31"
      },
      "expect": {
        "age": {
          "years": 34,
          "months": 11,
          "days": 16
        },
        "years": 34,
        "months": 419,
        "days": 12769,
        "next": "2025-01-15",
        "daysToNext": 15,
        "turns": 35
      },
      "source": "hand calculation in content.mdx; Python: (date(2024,12,31) - date(1990,1,15)).days = 12769; U.S. Naval Observatory, Leap Years: the Gregorian leap year rule. https://aa.usno.navy.mil/faq/leap_years"
    },
    {
      "given": {
        "birth": "2000-03-01",
        "on": "2024-02-28"
      },
      "expect": {
        "age": {
          "years": 23,
          "months": 11,
          "days": 27
        },
        "days": 8764,
        "next": "2024-03-01",
        "daysToNext": 2
      },
      "source": "hand calculation in content.mdx; Python: (date(2024,2,28) - date(2000,3,1)).days = 8764; U.S. Naval Observatory, Leap Years: the Gregorian leap year rule. https://aa.usno.navy.mil/faq/leap_years"
    },
    {
      "given": {
        "birth": "2000-02-29",
        "on": "2026-02-28"
      },
      "expect": {
        "age": {
          "years": 26,
          "months": 0,
          "days": 0
        },
        "days": 9496,
        "bornOn": "Tuesday",
        "next": "2027-02-28",
        "daysToNext": 365,
        "turns": 27
      },
      "source": "hand calculation in content.mdx; Python: (date(2026,2,28) - date(2000,2,29)).days = 9496; U.S. Naval Observatory, Leap Years: the Gregorian leap year rule. https://aa.usno.navy.mil/faq/leap_years"
    },
    {
      "given": {
        "birth": "2002-02-02",
        "on": "2026-09-27",
        "name": "Pat"
      },
      "expect": {
        "age": {
          "years": 24,
          "months": 7,
          "days": 25
        },
        "who": "Pat",
        "weeks": {
          "weeks": 1286,
          "days": 1
        },
        "days": 9003,
        "bornOn": "Saturday",
        "next": "2027-02-02",
        "daysToNext": 128
      },
      "source": "hand calculation in content.mdx; Python: (date(2026,9,27) - date(2002,2,2)).days = 9003; U.S. Naval Observatory, Leap Years: the Gregorian leap year rule. https://aa.usno.navy.mil/faq/leap_years"
    }
  ],
  "sources": [
    "U.S. Naval Observatory, Leap Years: the Gregorian leap year rule. https://aa.usno.navy.mil/faq/leap_years"
  ],
  "related": [
    "chronological-age",
    "age-difference",
    "days-between-dates"
  ],
  "changelog": [
    {
      "date": "2026-09-29",
      "note": "Worked examples name a published reference for their rule."
    }
  ]
}
