S
SteveZmyname
Hello
Just like the subject says I am using two datetimepickers a start and end
and would like to know the hours between the two (or days). So far I have
Private Sub calcHours()
Dim totalHours As Integer
'totalHours = DateInitiatedDateTimePicker.Value.Day -
DateFinishedDateTimePicker.Value.Day
Dim startDate As DateTime = DateInitiatedDateTimePicker.Value
Dim finishDate As DateTime = DateFinishedDateTimePicker.Value
totalHours = startDate.Day + finishDate.Day
'totalHours = DateFinishedDateTimePicker.Value.Day -
DateInitiatedDateTimePicker.Value.Day
HoursTextBox.Text = totalHours
MessageBox.Show(totalHours)
End Sub
Not sure whether to add or subtract the dates. If I subtract then I always
get a 0.
If I add using the dates 1/15/2010 for start and 2/2/2010 for end I get a
value of 10.
This doesn't make sense to me for either hours or days.
Just like the subject says I am using two datetimepickers a start and end
and would like to know the hours between the two (or days). So far I have
Private Sub calcHours()
Dim totalHours As Integer
'totalHours = DateInitiatedDateTimePicker.Value.Day -
DateFinishedDateTimePicker.Value.Day
Dim startDate As DateTime = DateInitiatedDateTimePicker.Value
Dim finishDate As DateTime = DateFinishedDateTimePicker.Value
totalHours = startDate.Day + finishDate.Day
'totalHours = DateFinishedDateTimePicker.Value.Day -
DateInitiatedDateTimePicker.Value.Day
HoursTextBox.Text = totalHours
MessageBox.Show(totalHours)
End Sub
Not sure whether to add or subtract the dates. If I subtract then I always
get a 0.
If I add using the dates 1/15/2010 for start and 2/2/2010 for end I get a
value of 10.
This doesn't make sense to me for either hours or days.