Software Venture Consulting
ToMarket

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
Training
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


Privacy Policy



FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

Age ( Birth; theDate; Format )

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 3.4  (16 votes)
  Discuss this Custom Function

Geoff Wells, DataIsland Software LLC
http://www.dataisland.com

Calculates Age in three formats

Sample Input:
Age ( 5/14/1946; 5/11/2004; 3 )
Sample Output:
57 years and 11 months, and 27 days


 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed

Description:

The Age function will calculate a persons age, on any date, in three different formats -

1 / Years
2 / Years and Days
3 / Years, Months and Days.

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

This is my Custom Function and I want to edit it

Discuss:

Can you find it.I hop you cn find it in a good.

william royster, ohio
March 26, 2009 7:45am

Just one little addition to the leap year factor that might be easily forgotten...
The year 2000 is not a leap year, because it's divisible by 400.

Let ( leapFactor = If ( Mod ( Year ( theDate ) ; 4 ) = 0 AND Mod ( Year ( theDate ) ; 400 ) ≠ 0 ; 1 ; 0 );

Alexis Gehrt, Laax / Switzerland
November 30, 2009 8:35am

Sorry, Alexis, but check your calendar again. 2000 WAS a leap year, because it's divisible by 400. The 'century' years are normally not leap years (1800, 1900), except when divisible by 400. So the calc for leapFactor should really be:

leapFactor = Case ( Mod ( Year ( theDate ) ; 400 ) = 0 ; 1 ;
// 'century' years divisible by 400 are leap years
Mod ( Year ( theDate ) ; 100 ) = 0 ; 0 ;
// 'century' years not divisible by 400 are not leap years
Mod ( Year ( theDate ) ; 4 ) = 0 ; 1 ;
// years divisible by 4 are leap years
0 )

Rob Woof, Sydney/Australia
August 08, 2010 7:13pm

There's another way that bypasses the Case statement.

leapFactor = If ( Mod ( Year ( theDate ) ; 400 ) = 0 ; 1 ; 0 ) // 'century' years divisible by 400 are leap years
- If ( Mod ( Year ( theDate ) ; 100 ) = 0 ; 1 ; 0 ) // 'century' years not divisible by 400 are not leap years
+ If ( Mod ( Year ( theDate ) ; 4 ) = 0 ; 1 ; 0 ) // years divisible by 4 are leap years

A year that is divisible by 400 (e.g. 1600, 2000) will evaluate to 1 - 1 + 1 = 1.
A year that is divisible by 100 but not by 400 (e.g. 1300, 1900) will evaluate to 1 - 1 + 0 = 0.
A year that is divisible by 4 but not by 100 (e.g. 1972, 1988) will evaluate to 1 - 0 + 0 = 1.
Any other year (i.e. not a leap year) will evaluate to 0 - 0 + 0 = 0.

Just another way to skin this particular cat.

Rob Woof, Sydney/Australia
August 11, 2010 8:48pm

No need to do this at all: FileMaker will handle leap years itself if you use it's own date comparisons.
Go look at http://www.briandunning.com/cf/518

That one lets you pick a comparison date (just use Get( CurrentDate ) for the second parameter if you want current age), handles negative age comparisons, and returns multiple formats.

Also, it has the decided advantage of actually returning correct values, even when dealing with leap years and on the actual birthday anniversary because it uses FileMaker's own date comparisons to get it right.

Daniel A. Shockley, New York, NY
May 04, 2011 11:16am

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
City/Location:
Comment:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 5 + 4 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. phpArrayValue ( array ; key ; pos )
  (Fri, Jan 27, 1:49pm)
2. solfm_timeToMinutes (theTime;roundSec)
  (Fri, Jan 20, 6:26am)
3. filterLines(filterField;filterValue;Result)
  (Sat, Jan 14, 2:20pm)
4. getMaxValue ( theList )
  (Thu, Jan 12, 1:06pm)
5. MiddleWordsIncPunct ( text ; startingWord ; numberOfWords )
  (Sat, Jan 07, 9:16am)
6. WindowInfo
  (Fri, Jan 06, 12:39pm)
7. CenterWindow in Window vert horiz (demension)
  (Fri, Jan 06, 12:25pm)
8. UTF8_to_TXT ( Text , Platform )
  (Wed, Dec 28, 10:44pm)

RSS Feed of Custom Functions