Posted on: 7/31/2013 8:28:43 PM | Views : 209

Can any body sort out what's problem is going on to get the exact day using this code. I'm getting 1 day less then exact day rest other is working well  by using this code below.
Dim d1, d2 As Date Dim days, months, years As Long
d1 = DateTime.Parse(TextBox1.Text) ex: 13/11/1989 d2 = 'DateTime.Now If d1 >= d2 Then ClientScript.RegisterstartupScript(Me.GetType(),"Key","<script>alert('Invalid Date')</script>") Else

years = Year(d1) months = Month(d1) days = d1.Day
years = Year(d2) - years months = Month(d2) - months days = d2.Day - days
If Math.Sign(days) = -1 Then days = 30 - Math.Abs(days) months = months - 1 End If
If Math.Sign(months) = -1 Then months = 12 - Math.Abs(months) years = years - 1 End If Label1.Text = "years" & years & "," & "Months" & months ...

Go to the complete details ...