Am I the first one to find that DateDiff has a rounding error?
I tried to calculate the age of disabled children in a school by taking their birth date from the table and then entering an effective date of the report. There is enough of a rounding error that by the age of 3 if your report date is the day before the day of the day of the birth date you will be off by 1 year.
Effective Date 11/18/2009
Birthdate 11/20/2007
Date Diff days 729/365 = 1.9973
Age rounds down to 1
Effective Date 11/19/2009
Birthdate 11/20/2007
Date Diff days 730/365 = 2.0000
age rounds to 2
They wont be 2 until the next day.
Effective Date 11/20/2009
Birthdate 11/20/2007
Date Diff days 731/365 = 2.0027
Age rounds to 2 but the calculation is .0027 off
By age 21 the rounding is off by 2 days.
Here is the forumla I used:
truncate(DateDiff("d",{NAME.BIRTHDATE},{?Effective Date})/365,0)
The childs birth date is in the NAME table in the BIRTHDATE field. I have the user input the Effective Date of the report.
Does anyone know a way to accurately display on a Crystal Report how old someone is on the effective date of a report when calculated from the persons birth date?
Your help would be greatly appreciated by all the school districts serving disabled children in the state.
Cordell V