Am working with vb.net and Sql Server2000.on my program has to calculate the difference between two dates ,the result should be in months.ie RETIREDATE - HIREDDATE=number of months served.Surprisingly ,am getting ZERO months as a result.below is my code;
VB Code:
Public Overloads Function DateDiff( _
ByVal Interval As DateInterval, _
ByVal Date1 As Date, _
ByVal Date2 As Date) As Integer
VB Code:
Private Sub DateTimePicker3_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DateTimePicker3.ValueChanged
Dim service As integer
service = DateDiff(DateInterval.Month, DateTimePicker3.Value, CDate(txtRetireDate.Text))
txtService.Text = service.ToString
End Sub
I am suspecting that the final statement (txtService.Text = service.ToString)might be the problem???
note
atetimepicker3 holds DATEHIRED.
Please help this urgently.!!!!!.I have been trying to figure it out in several ways to no avail.
I hope I will get a helpful support.thanks