calculate age in vb.net
To calculate age of a person using VB.Net from date of birth you can use DateDiff builtin function here a user function to calculate age in years.
Public Function Calculate_Age(ByVal Birth_Date As Object) As Long
If Not IsDate(Birth_Date) Then Return 0
Dim dtTemp As Date
Try
dtTemp = CDate(Birth_Date)
Catch ex As Exception
Return 0
End Try
If dtTemp > Now Then Return 0
Try
Return DateDiff("yyyy", dtTemp, Date.Now) + (DateSerial(Year(Date.Now), Month(dtTemp), dtTemp.Day) >= Date.Now)
Catch ex As Exception
Return 0
End Try
End Function
Advertisements
MySQL HOSTING
MySQL hosting provider, clustering and replication supported. DBA Services Included.
SQL SERVER HOSTING
Reliable, powerful SQL Server 2008 hosting with ASP.NET on Windows 2008 Servers.
SQL Server DBA
I am a
SQL Server DBA with almost 9 years of experience in database
technologies.
I am again in process of redesigning this website using ASP.NET 2.0 and AJAX. The main purpose
of new SQL DBA website is to offer more features and make it easy for
me to update contents on regular basis.