Date Diff

Here is a code snippet to check the difference in dates:

Public Function Age(ByVal Birthdate As System.DateTime) As Long
Try
Dim CurrentDate As System.DateTime = System.DateTime.Today
Select Case Month(Birthdate)
    Case Is < Month(System.DateTime.Today)
        Age = DateDiff("YYYY", Birthdate, Now())
    Case Is = Month(CurrentDate)
         Select Case Day(Birthdate)
             Case Is < Day(CurrentDate)
                Age = DateDiff("YYYY", Birthdate, Now())
             Case Is = Day(CurrentDate)
                Age = DateDiff("YYYY", Birthdate, Now())
             Case Is > Day(CurrentDate)
                  Age = DateDiff("YYYY", Birthdate, Now()) - 1
         End Select
    Case Is > Month(CurrentDate)
        Age = DateDiff("YYYY", Birthdate, Now()) - 1
    Case Else
        Age = 0
End Select
Catch ex As System.Exception
    'Error handling code does here
End Try
End Function