Brian Dunning's FileMaker Custom Functions

YearsInteger ( date1 ; date2 )

Returns an integer year count between two dates, such as a person's age.

  Average rating: 4.1 (34 votes) Log in to vote

Kieren MacMillan   Kieren MacMillan
kierencom
www.kierencom.ca

Share on Facebook Share on Twitter

  Sample input:
YearsAsInt( birthdate ; Get ( CurrentDate ) )
  Sample output:
34

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

This calculation returns an integer year count between the two supplied dates -- perfect for calculating someone's age. It correctly handles all cases and is unaffected by (and unconcerned with!) leap year and other calendar variations/anomolies. This is accomplished by converting each date to a "floating point number" and then simply taking the integer portion of the difference.

 

Comments

Ian Moree   Ian Moree, Nassau Bahamaas
Mar 28, 2012
Looking @ this & noticed you accounted for leap year using a different approach but same answer.

Great Job!

QUick and neat..

KUDOS>>
 

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 15 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:

Under construction. Email me your wish list for improvements.