Tim Maxey .NET Technology Blog & Resources
I needed to display the age of of a birthday field from a database. I was so tired of coding and came across this function!
I got this from a guy named "hans" on a forum, great little function I didn't have to write!
Private Function Age(ByVal Birthday As DateTime) As Integer
Dim year As Integer = Today.Year - Birthday.Year
If Today.Month < Birthday.Month Or (Today.Month = Birthday.Month And Today.Day < Birthday.Day) Then
Return year - 1
Else
Return year
End If
End Function