How to calculate the difference between two times for the same day in hours
Posted on 2010-09-15
I've been searching all over the web and can't quite find the solution to what I need. I would like to calculate the difference between two times formatted in military time in hours (with two decimal places). The start and end times will be entered as text into a form and the difference (or total time below) is needed as a value for import into our work ticket system. It will be assumed that the times entered will always be on the same date, so it may be useful to return an error if the end time is prior to the start time.
Start time: 10:00 (manually entered)
End time: 13:30 (manually entered)
Total time: 1.50 hours (calculated upon form submit)
Any help would be greatly appreciated. Thanks in advance!