Hi there folks, I am trying to calulate the number of hours an employee has worked based on the start and finish times that the user inputs to a form using the following code:-
startTime = txtstartTime.Value
finishTime = txtfinishTime.Value
hoursWorked = [finishTime] - [startTime]
Now this works fine if the start and finish times are on the same day. The problem I am having is that if somebody works through midnight, the calculation falls over.
e.g. if somebody starts at 23:00 and finishes at 01:00 then hoursWorked is 22 hours which is obviously wrong.
Can somebody point me in the direction of how to solve this as I am stumped.
Thanks
startTime = txtstartTime.Value
finishTime = txtfinishTime.Value
hoursWorked = [finishTime] - [startTime]
Now this works fine if the start and finish times are on the same day. The problem I am having is that if somebody works through midnight, the calculation falls over.
e.g. if somebody starts at 23:00 and finishes at 01:00 then hoursWorked is 22 hours which is obviously wrong.
Can somebody point me in the direction of how to solve this as I am stumped.
Thanks
