4 Replies Latest reply on Dec 27, 2010 11:15 AM by lrbeatty

# Calculating an age in years based on a specific date

### Title

Calculating an age in years based on a specific date

### Post

I have a regular age calculation that works fine based on birthdate, but I am looking for a calculation that will give an age based on a specific date. For example what age (in years) will a person be on August 31, 2011. Appreciate any help.

• ###### 1. Re: Calculating an age in years based on a specific date

Larry,

Would like to help you out, but your request is beyond my knowledge. However, I was wondering if you'd be willing to share your coding to compute age calculations? I was only able to base my calculation on the year of birth, meaning that the resulting ages are inaccurate when the current date precedes the date of the birth.

Ishulman@shiftct.com

• ###### 2. Re: Calculating an age in years based on a specific date

most age calculations use an expression similar to this:

Let ( [
Today = Get (CurrentDate) ;
bDay = Date ( Month ( BirthdateField ) ; Day ( BirthdateField ) ; Year ( Today ) );
Age = Year ( Today ) - Year ( BirthdateField ) - ( Today < bDay )
] ;
If ( Age > 0 ; Age ; "" )
)

Because Get ( CurrentDate ) is used, this calculation must be unstored.

To use a different date other than Today, simply modify the first part of this expression, Today = .... to refer to a date field where you specify this different date:    Today = DateField

• ###### 3. Re: Calculating an age in years based on a specific date

Ishulman,

This is what I used for age that works well for us.

Let ( [now = Get ( CurrentDate ) ;thisBD = Date ( Month ( DOB ) ; Day ( DOB ) ; Year ( now ) ) ;passed = now < thisBD ] ;Year ( now ) - Year ( DOB ) - passed)

• ###### 4. Re: Calculating an age in years based on a specific date

Thanks Phil. That works awesome. Just what I needed!