Brian Dunning's FileMaker Custom Functions

AGE ( BirthDate )

Calculate the correct Age :)

  Average rating: 4.3 (38 votes) Log in to vote

meddved   meddved - Show more from this author
meddved
www.meddved.bg

Share on Facebook Share on Twitter

  Sample input:
AGE ( "14/04/1981" )
  Sample output:
29

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This function calculates the correct age.
Auto-correction for leap years.

 

Comments

comment   comment, VR
Apr 13, 2011
"This function calculates the correct age."

No, it doesn't: a person born in 1900-03-15 is not yet 100 years old in 2000-03-14.


Why not do the simple thing:

Year ( today ) - Year ( DOB ) -
( today < Date ( Month ( DOB ) ; Day ( DOB ) ; Year ( today ) ) )
 
Daniel A. Shockley   Daniel A. Shockley, New York, NY
May 4, 2011
Try the following instead:
http://www.briandunning.com/cf/518

It works, even on the birthday anniversaries and when dealing with leap years. It also gives you more detail and options, if desired.
 
David   David
Sep 21, 2016
thank you very much
It has been very useful for my application.
 
flusheDData   flusheDData, n/a
Dec 6, 2020
Hi,
Why not the simplest Int ( ( Get ( CurrentDate ) - BirthDate ) / 365,25 ) ?
 
flusheDData   flusheDData, n/a
Dec 6, 2020
I answer myself. Because sometimes it does not work.
Eg.: for a BOD being 04/05/2008 and today being 04/05/2011 it gives 2 when it should be 3.
So for me the most simple calculation would be VR's
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: