Brian Dunning's FileMaker Custom Functions

AccurateAge ( start ; end )

Calculate Age in Years and Days Accurately

  Average rating: 5.0 (1 vote) Log in to vote

Tom G   Tom G - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
AccurateAge ( "7/4/1776" ; "2/13/2018" ) // age of the USA on date of this upload
  Sample output:
241 years 224 days

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

AccurateAge accurately calculates the period of time between any two dates and displayed in the form of "x years y days".
It also handles leap years in the start or end dates.
Can be used to determine age, shelf life, duration, time to expiration, etc. Basically any period between two dates.

 

Comments

KHALID SAID   KHALID SAID , K.D
Nov 23, 2019
I want a function that calculates the number of days between two dates (only the number of days)
 
Tom G   Tom G
Nov 24, 2019
Just do:

GetasDate ( [EndDate] ) - GetasDate ( [StartDate] )

FileMaker automatically calculates the difference in number of days.
 
TA   TA
May 20, 2020
Thanks
Can you make it in
Years, Months, Days ?
 
Tom G   Tom G
May 21, 2020
Sorry, no, not at this time.
 
Alireza   Alireza
Jul 1, 2020
hi and thank you
how can i edit this function to split it into two calculations for the same record
for alive people like above and for dead people it counts only the years and days that they lived

thanks again
 
Tom G   Tom G
Jul 1, 2020
You can do that by manipulating the parameter values.
For example (DateofBirth and DateofDeath are both date fields in the person's record):

Let ( [
start = DateofBirth ;
end = If ( DateofDeath ; DateofDeath ; Get ( CurrentDate ) )
] ;

AccurateAge ( start ; end )
)
 
Tom G   Tom G
Aug 16, 2021
TA, Accurate Age YMD now available. Calculates age in years-months-days...
 

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: