PC Pro Podcast 57

The big debate of the week is Wolfram Alpha – revolutionary tool or know-nothing toy? The team also discuss the future of tabbed browsing, concerns over the price of Windows 7 and the dangers of being electrocuted by your iPod. Our hot hardware hopeful is the tiny Acer Revo system, the first commercial PC to partner an Atom CPU with discrete graphics.

ASP.NET Calculating Age (VB)

I came across the issue today where I needed to calculate the age of a user of a system for the Equal Opportunities policy – there didn’t seem to be a good VB function out there – some of them were ridiculously long-winded, so I wrote one that is short and very processor efficient.

Function calculateAge(ByVal DateOfBirth As Date) As Integer

Dim TodaysDate As Date = Date.Today()

Dim Age As Integer = TodaysDate.Year – DateOfBirth.Year

If TodaysDate.Month < DateOfBirth.Month Or (TodaysDate.Month = DateOfBirth.Month And TodaysDate.Day < DateOfBirth.Day) Then
Age = Age – 1
End If

calculateAge = Age

Age = Nothing
TodaysDate = Nothing

End Function