Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
DateTimePicker | Excel Programming | |||
DateTimePicker control problem | Excel Programming | |||
Determining work hours between dates / hours | Excel Worksheet Functions | |||
dates to hours | Excel Discussion (Misc queries) | |||
DateTimePicker | Excel Programming |