Use this formula to calculate a person's current age from a date of birth. The result updates automatically as time passes.
if(
empty(prop("Date of birth")),
0,
dateBetween(now(), prop("Date of birth"), "years")
)What this formula does
The formula returns the number of complete years between today and the date in Date of birth. If the date is empty, it returns 0 instead of an error.
Database setup
Create these properties in your Notion database:
| Property | Type | Example |
|---|---|---|
Name | Title | Alex Martin |
Date of birth | Date | March 12, 1994 |
Age | Formula | The formula above |
The property name is case-sensitive. If your date property is called Birthday, replace every prop("Date of birth") with prop("Birthday").
Add a text label
Use this variant when you want the result to read like 32 years:
if(
empty(prop("Date of birth")),
"No birth date",
format(dateBetween(now(), prop("Date of birth"), "years")) + " years"
)Calculate age on a specific date
For an age at the time of an event, replace now() with another date property:
if(
or(empty(prop("Date of birth")), empty(prop("Event date"))),
0,
dateBetween(prop("Event date"), prop("Date of birth"), "years")
)This is useful for event records, applications, historical research, or medical records where the age should not change later.
Common problems
If the result is negative, check that the date of birth is not in the future.
If the age seems one year too high, remember that dateBetween() measures complete years between dates. Check the month and day on both dates, and make sure the date property does not include an unexpected time.
If Notion shows an error, confirm that Date of birth is a Date property and that the name in the formula matches it exactly.