Function: Age
Description
The Age function returns the number of whole intervals between the given start date and the end date.
The optional parameter interval specifies the time interval (essentially the units) from which the age is computed, with 1=years, 2=months, 3=weeks, 4=days, 5=hours, 6=minutes, and 7=seconds. The default interval is 1 (years).
The enddate parameter is also optional, and has a default value of Today(). Thus, the expression Age(birthdate) will return a person's current age in years.
The startdate and enddate are full date/time values, so if they happen to include a time portion, the time is considered significant when computing the age, even when computing intervals of years, months, weeks or days. If startdate is after enddate, the return value is negative.
NOTE:
This function returns a null value if there is an error. An error can occur under the following conditions:

The specified interval is not one of the interval values listed above (range is 1 to 7).

The specified interval is 7 (meaning "seconds"), but the elapsed time would exceed the capacity of a long integer (2147483647). The cutoff at which the age in seconds begins to return an error is an elapsed time of 24855 days, 3 hours, and 14 minutes (i.e., a little over 68 years).
Syntax
Age(startdate[,enddate[,interval]])
Return value
This function returns a number.
Calculated field example
Using a StartDate of 04/15/1957 and an EndDate of 01/27/2005, the following calculated field expression would return 47 (years): Age(StartDate,EndDate,1)
Filter/Find example
Records with an age of 47 years can be found using the expression: Age(StartDate,EndDate,1)=47
© 2024 Altair Engineering Inc. All Rights Reserved.