how to know the age of user?

liunx

Guest
how to compare the age with the System.DateTime.Now?
if the user select his birthdate from three dropdownlists (Month, Day, Year), how do we get his age? so that we can validate whether his age is qualified to register as member onot.. anyone knows how to do this?Dim DtNow As DateTime = Datetime.Now
Dim DtBirthDate As DateTime = cdate(ddlMonth.SelectedValue & "/" & ddlDay.SelectedValue & "/" & ddlYear.SelectedValue)

If (DtNow.Subtract(DtBirthDate).Days >= (18 * 365)) Then
'Do something
Else
'Do something else
End Ifthanks!! it works!!Awesome!
 
Back
Top