CR 8.5 pulling from SQL2000 data through ODBC connection.
Okay, I have searched this site and I did get the formulas for calculating age and at first I thought that my problems were solved. However, I started looking through my results and I noticed that my age is not calculating correctly. I have tried this formula and can not get it to work.
DateTimeVar Birth:= {ASTU4004.BIRTHDATE}
DateTimeVar Ann := CurrentDate
if (Month(Ann) * 100) + Day (Ann) >=(Month(Birth) *100) + Day (Birth)
then Year (Ann) - Year(Birth)
else Year (Ann) - Year(Birth) -1
I have done this formula, but the age is not calculating correctly.
numbervar var_totalmonths := DateDiff ("m",{ASTU4004.BIRTHDATE},CurrentDate);
stringvar var_years := ToText(var_totalmonths/12);
stringvar var_yearstrimmed := If Length (var_years) = 5 Then (Left(var_years,2)) Else (Left(var_years,1));
Cstr(var_yearstrimmed) + "yrs "
Our birthday field has that dang annoying time in it as well. So birthdays look like 04/28/1978 12:00AM Is the time what is screwing this up?
What ends up happening is that everyone's age looks good except for the ones with birthdays this month. If they have a birthday in April, the formula already advanced their age even though they have not had their birthday yet.
I need this to be accurate since we are doing a census report for the government. Any help would be greatly appreciated.
Okay, I have searched this site and I did get the formulas for calculating age and at first I thought that my problems were solved. However, I started looking through my results and I noticed that my age is not calculating correctly. I have tried this formula and can not get it to work.
DateTimeVar Birth:= {ASTU4004.BIRTHDATE}
DateTimeVar Ann := CurrentDate
if (Month(Ann) * 100) + Day (Ann) >=(Month(Birth) *100) + Day (Birth)
then Year (Ann) - Year(Birth)
else Year (Ann) - Year(Birth) -1
I have done this formula, but the age is not calculating correctly.
numbervar var_totalmonths := DateDiff ("m",{ASTU4004.BIRTHDATE},CurrentDate);
stringvar var_years := ToText(var_totalmonths/12);
stringvar var_yearstrimmed := If Length (var_years) = 5 Then (Left(var_years,2)) Else (Left(var_years,1));
Cstr(var_yearstrimmed) + "yrs "
Our birthday field has that dang annoying time in it as well. So birthdays look like 04/28/1978 12:00AM Is the time what is screwing this up?
What ends up happening is that everyone's age looks good except for the ones with birthdays this month. If they have a birthday in April, the formula already advanced their age even though they have not had their birthday yet.
I need this to be accurate since we are doing a census report for the government. Any help would be greatly appreciated.