I need to calculate the age in Years,Months and Days for which i am using the following code, but it give inappropriate result
vb Code:
Dim d As Date If Date.TryParse(Me.DOB.Text, d) Then Dim ts As TimeSpan = Today - d Dim y As Double Dim m As Double Dim ds As Double = ts.TotalDays y = Math.Floor(ds / 365) ds -= y * 365 m = Math.Floor(ds / 31) ds -= m * 31 Me.TxtYears.Text = cstr(y) Me.TxtMonths.Text=Cstr(m) Me.TxtDays.Text = Cstr(ds) End If
I also need to do the reverse calculation i.e get the DOB from the Age using the txtYears, txtMonths and TxtDays
Plz Help Me

