This program calculates the elapsed hours, minutes and seconds between two times. The day, month and year are ignored. If the start time comes after the end time, the program assumes that midnight is crossed, i.e., the end time is on the day after the start time.
Times must be entered in 24-hour, "military" form. If you want to know the elapsed time between 3 pm and 1 am, you'd enter 15, 0 and 0 for the start time, and then 1, 0, and 0 for the end time. The result would be 10 hours, 0 minutes, and 0 seconds, and the label after the elapsed time would say 'Midnight was crossed'.
Click on the "Now" button to set the start or end time to the current local time.
As you enter values, the result will be automatically calculated. Use the tab key to proceed from box to box. You must "leave" a box for the result to be updated, by clicking outside the boxes, or by hitting the tab key. The Calculate button forces a recalculation. If you enter junk, such as letters instead of numbers, you'll see an error message.
JavaScript code Copyright 2015 by Gary Gocek.