Calculating age from current date-DOB

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to display someones age using (date ()-DOB)/365 but I get years
with a decimal ( ie 76.7 years). If I change the format to "fixed" and set
the decimal places to "0" then it rounds up the age ( ie 77 years) How can I
display just 76 which is the more conventional way we talk about age.
 
Maybe this will help.

Public Function Age(DOB As Date) As Integer

Age = DateDiff("yyyy", DOB, Date) + (Date < DateSerial(Year(Date), Month(DOB),
Day(DOB)))

End Function
 
Back
Top