curatedapi

Age calculator

Exact age in years, months and days, plus the next birthday, with an explicit rule for 29 February birthdays.

Date of birth (YYYY-MM-DD).
Date to calculate the age on. Defaults to today in UTC.
When someone born on 29 February has a birthday in a common year. Options: feb28: on 28 February; mar1: on 1 March

Examples

Result: Leap-day birthday, 28 Feb rule

Years
Completed years.
1
Months
Completed months since the last birthday.
0
Days
Days since the last whole month.
0
Total months
Completed months since birth.
12
Total weeks
Completed weeks since birth.
52
Total days
Days since birth.
365
On date
The date the age was calculated on.
2001-02-28
Next birthday
Date of the next birthday.
2002-02-28
Days until next birthday
Days until the next birthday.
365

Calculator date/age@1.

How it is calculated

years = completed anniversaries; then months and days as in date/difference

Age on a given date as completed years, months and days. People born on 29 February reach a new age on 28 February in common years by default (the rule in New Zealand and Taiwan, and the one consistent with date arithmetic); choose mar1 for the 1 March rule used in the UK and Hong Kong.

  • Dates use the Gregorian calendar (ISO 8601). Adding months clamps to the month's last day (Jan 31 + 1 month = Feb 28 or 29).

References

Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.

Use it from your code

POST /v1/calc/date/ageVersion 1
curl https://api.curatedapi.com/v1/calc/date/age \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "birth_date": "2000-02-29",
    "on_date": "2001-02-28"
  }'
The same call in Python
import os

import requests

payload = {
    "birth_date": "2000-02-29",
    "on_date": "2001-02-28",
}
response = requests.post(
    "https://api.curatedapi.com/v1/calc/date/age",
    headers={"Authorization": f"Bearer {os.environ['CURATEDAPI_KEY']}"},
    json=payload,
    timeout=10,
)
print(response.json()["result"])
The same call in JavaScript
const payload = {
    "birth_date": "2000-02-29",
    "on_date": "2001-02-28",
};
const response = await fetch("https://api.curatedapi.com/v1/calc/date/age", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.CURATEDAPI_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(payload),
});
console.log((await response.json()).result);

MCP tool calc_date_age at https://mcp.curatedapi.com. Inputs, outputs and errors in the API reference.

Put it on your website

<div data-curatedapi-widget="date/age" data-key="capi_public_…"></div>
<script src="https://widgets.curatedapi.com/v1/widget.js" async></script>

Use a public key registered for your site. Calculations are billed like API calls. How widgets work.

Related calculators

Add this calculator to your website

Paste two lines into your page and your visitors get this calculator. Each use counts as one call on your plan, the same as the API.

Free for up to 1,000 uses a month. 50,000 uses a month cost $9.00 on the Starter plan.