Hello All,
I am having a difficult time calculating Age to display as years, months, and days. so far, i have got the years and months down (so i think) and am having trouble with the days part. Can anyone help? This is the formula i am using for years and months taken from a previous post here on this site:
//Age in Years and Months
NumberVar DoBVar := IIF((100 * MONTH(CURRENTDATE) + DAY(CURRENTDATE)) < (100 * MONTH({person.birthdate}) + DAY({person.birthdate})), 1, 0);
NumberVar MthVar := (DATEDIFF("m",{person.birthdate},CURRENTDATE) - DobVar) MOD 12;
NumberVar YrsVar := DATEDIFF("yyyy",{person.birthdate},CURRENTDATE) - DobVar;
StringVar MthYrs := TOTEXT(YrsVar,0) + " years " + TOTEXT(MthVar,0) + " months";
MthYrs;
--Any help would be greatly appreciated!! thanks, E
I am having a difficult time calculating Age to display as years, months, and days. so far, i have got the years and months down (so i think) and am having trouble with the days part. Can anyone help? This is the formula i am using for years and months taken from a previous post here on this site:
//Age in Years and Months
NumberVar DoBVar := IIF((100 * MONTH(CURRENTDATE) + DAY(CURRENTDATE)) < (100 * MONTH({person.birthdate}) + DAY({person.birthdate})), 1, 0);
NumberVar MthVar := (DATEDIFF("m",{person.birthdate},CURRENTDATE) - DobVar) MOD 12;
NumberVar YrsVar := DATEDIFF("yyyy",{person.birthdate},CURRENTDATE) - DobVar;
StringVar MthYrs := TOTEXT(YrsVar,0) + " years " + TOTEXT(MthVar,0) + " months";
MthYrs;
--Any help would be greatly appreciated!! thanks, E