March 20, 2017, 05:29 PM
Terri1977[SOLVED] Calculating Age
I am attempting to calculate a person's age.
Here is what I have so far. When it prints the age field, for all the records, the age is 0. Please assist.
BIRTH_DT/YYMD = HDATE(BIRTH_DATE, 'YYMD');
BEGIN_DATE/YYMD = '&BEGDATE';
AGE_IN_DAYS/I5 = BEGIN_DATE - BIRTH_DATE;
AGE/I2 = AGE_IN_DAYS/365.25;
This message has been edited. Last edited by: FP Mod Chuck, March 20, 2017, 05:30 PM
DougThat's the same as your
Calculate Birth Date post. The DATEADD is very powerful.
March 21, 2017, 12:15 PM
jgelonaWhy aren't you using DATEDIF?
AGE/I2=DATEDIF(BIRTH_DT,BEGIN_DT,'Y');
What you are doing can actually give a bad result because of leap days. I had this argument with the Feds several years ago and of course I won.