How can I calculate user age by his birthday date?
Stay safe.
How can I calculate user age by his birthday date?
Stay safe.
I’m sorry but none of the solutions worked for me. It seems they don’t take into account the leap years.
To me the solution was to emulate what you do in real life:
Here is the formula (i’m using a date / time picker):
Hope it helps someone!
Don’t forget about Leap years…
When you do ‘Current Date time’ - ‘Birth date’:format as days, it will result in the total amount of days, counting leap years (366 days). So if you want to get closer to the real age, you should divide by 365.25
If you want to get perfect calc, you then need to value how many leap years were there during the total period, subtract, and than divide by 365…
There’s no need to divide by anything and so no need to estimate the number of days per year:
This works perfectly for me, even with a birthday on 29 February.
In the value:formatted as number part, use 1 for yes and 0 for no.
I got to this simple solution thanks to the insight of @Cosmic.Steve, thank you.
Here is a more simple way
format the dates as a decimal yyyy.mmdd, convert them to a number, subtract the two, round down, and you’ll have the exact age every time.