Forum Academy Marketplace Showcase Pricing Features

How to calculate exact age

Hello !

I have found many solutions here on this forum. Actually, i use one of them : Current date/time - DOB:format as days / 365:floor
But it’s not perfect, i need to check users are at least 18 years old, but there is always a gap of days, for example :

Let’s say a person was born on June 10, 2003, so today this person is 18, bit now let’s say a person was born on June 13, 2003, with this current solution, this person will always be considered as 18 years old.

Can someone help me to solve this problem ?

Hi @matisse.serenitrip,

Following thing will do the trick. Quite of a work around but it works.

So what it does it first checking if the person has already had its birthday (set the year of the birthday to current date’s year and check if it is bigger or not).
Then within the formatted as text it just subtracts the years of both numbers and if the person hasn’t had its birthday it subtracts it with 1

Thank you a lot, that’s worked :slightly_smiling_face:

Here I am again, facing a new problem of the same kind.
This time I have to calculate the age of a bike, in months, because it must not exceed 24 months. Knowing that I have to transmit its age (still in months) to an API, i really need the age in month.

I tried without success to do it by myself :sweat_smile:

Something like this would work:
A:current date & B:DOB
(A:extractYear-B:ExtractYear)*12+(A:ExtractMonth-B:ExtractMonth)