DateDifference
I need to calculate the difference between two dates and find out how old was the person at particular point of time. I need to find the nearest birthday and cut off point is 6 months.
Ex:
DOB: 01/01/2000
06/01/2004
Difference is 4 years and 6 months, but nearest birthday will round it to 5 years.
DOB: 01/25/2000
06/23/2004
Difference is 4 years and 5 months and about 28 days. nearest birthday should be 4 years.
My Solution that doesn't take days into consideration.
UPDATE test1 SET test1.IssueAge = Round(DateDiff('d',[DOB],[Date])/365.25)
.25 takes care of leap year.
Do you have a better solution?
Thank you guys.
I need to calculate the difference between two dates and find out how old was the person at particular point of time. I need to find the nearest birthday and cut off point is 6 months.
Ex:
DOB: 01/01/2000
06/01/2004
Difference is 4 years and 6 months, but nearest birthday will round it to 5 years.
DOB: 01/25/2000
06/23/2004
Difference is 4 years and 5 months and about 28 days. nearest birthday should be 4 years.
My Solution that doesn't take days into consideration.
UPDATE test1 SET test1.IssueAge = Round(DateDiff('d',[DOB],[Date])/365.25)
.25 takes care of leap year.
Do you have a better solution?
Thank you guys.