2 Replies Latest reply on Apr 23, 2009 6:32 PM by comment_1

# How can I calculate Age in YEARS AND MONTHS form Date of Birth and Present Date ???

### Title

How can I calculate Age in YEARS AND MONTHS form Date of Birth and Present Date ???

### Post

New York State now requires a patient's age in years AND MONTHS on every prescription written. Using Date of Birth and Present Date fields,  I have been using a calculation code that yields a result in years only.  I MUST have a result that yields, for example, "45 year(s), 6 month(s).  Can anyone provide a calculation code (or direct me to where I might find one) that will produce the foregoing ???  Using standard FMP v9.3 (not advanced).

Any assistance is very greatly appreciated,

Barry Sommers

w2bs@aol.com

• ###### 1. Re: How can I calculate Age in YEARS AND MONTHS form Date of Birth and Present Date ???

Since you've already got years, you need the number of months.

IF (month(table::Birthdate) = month(Get(currentdate)), 0 , 11 - Abs ( Month(get(currentdate)) - Month(table::birthdate)))

• ###### 2. Re: How can I calculate Age in YEARS AND MONTHS form Date of Birth and Present Date ???

PhilModJunk wrote:
IF (month(table::Birthdate) = month(Get(currentdate)), 0 , 11 - Abs ( Month(get(currentdate)) - Month(table::birthdate)))

So if a person was born in March, and today is April, they are 10 months old?!

Try:

Let ( [
start = BirthDate ;
end = Get ( CurrentDate ) ;
m = 12 * ( Year ( end ) - Year ( start ) ) + Month ( end ) - Month ( start )
- ( Day ( end ) < Day ( start ) )
] ;
Div ( m ; 12 ) & " year(s), " & Mod ( m ; 12 ) & " month(s)"
)