Calculating Age

Try
Dim dbdate As String = "25 April 1976"
Dim newdate As DateTime = Convert.ToDateTime(dbdate)
Response.Write(newdate.ToString("d") & "<br>")
Response.Write("Age : " & DateDiff("yyyy", newdate, Now()))
Catch ex As Exception
Response.Write(ex.Message.ToString)
End Try

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>