Help

Re: What would be the formula to show the age of a person as of today? I need the result in years

6118 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Sandra_McCann
4 - Data Explorer
4 - Data Explorer

DATETIME_DIFF([date1], [date2], ‘units’)

I saw this formula but how do I modify it to include my fields and a result in years for the units?

24 Replies 24
Tim_Wilson
7 - App Architect
7 - App Architect

Here’s my age formula: DATETIME_DIFF(TODAY(), Birthday, ‘years’)

I have a field named “Birthday” in my table that contains the birthdate.

I use Tim’s method, understanding you get an “ERROR” if the birthday field is not filled in.

Sophie_Zifcak
4 - Data Explorer
4 - Data Explorer

What do I do If I need my output to be years and months?

To get the age of a person in months:
DATETIME_DIFF(TODAY(), Birthday, 'months')
-> 346

Modifying the above to always give you the remainder when dividing by years, using MOD:
MOD(DATETIME_DIFF(TODAY(), Birthday, 'months'), 12)
-> 10

Finally, concatenating that with the age in years and adding units:
DATETIME_DIFF(TODAY(), Birthday, 'years') & ' years, ' & MOD(DATETIME_DIFF(TODAY(), Birthday, 'months'), 12) & ' months'
-> 28 years, 10 months

For the formula to work for me, I needed to make: , Birthday, => ,{Birthday},

Thanks for the help.

Trying to use your DATETIME_DIFF(TODAY(), Birthday, ‘years’)

Still getting that error!! Please help!

Please send me the entire code formula! Thanks.

DATETIME_DIFF(TODAY(), {Birthday}, ‘years’)

And {Birthday} is a field in my table, of course.

Hope that works for you.

Still giving the formula error!