Q:

Calculate age in months given date of birth - vb.net

Could someone give me an example of a function that would return an integer (how many months old) based on a persons age when given the date of birth?
Thanks,
Tristan

A:

Function AgeInMonths(ByVal birthDate As Date) As Long
    Return Microsoft.VisualBasic.DateDiff(Microsoft.VisualBasic.DateInterval.Month, birthDate, Date.Today)
End Function

