Elapsed Time Calculator
Calculate time difference between two timestamps in hours, minutes, and seconds.
Supports AM/PM and 24-hour formats with overnight span detection.
Elapsed time is the duration between a start time and an end time. While the concept is simple, calculation requires careful handling of clock rollovers (midnight crossing), different time formats (12-hour vs. 24-hour), and unit conversions between hours, minutes, and seconds.
Basic elapsed time formula:
Elapsed Time = End Time − Start Time
If the result is negative (end time is on the next day):
Elapsed Time = (End Time + 24 hours) − Start Time
Decomposing into components:
Total Seconds = (Hours × 3600) + (Minutes × 60) + Seconds
Elapsed Seconds = End Total Seconds − Start Total Seconds
From elapsed seconds:
Hours = Elapsed Seconds ÷ 3600 (integer part)
Minutes = (Elapsed Seconds mod 3600) ÷ 60
Seconds = Elapsed Seconds mod 60
Worked example — same day: Start: 9:47:23 AM → 9 × 3600 + 47 × 60 + 23 = 35,243 seconds End: 2:15:08 PM → 14 × 3600 + 15 × 60 + 8 = 51,308 seconds Elapsed: 51,308 − 35,243 = 16,065 seconds Decomposed: 16,065 ÷ 3600 = 4 hours, remainder 3465 → 3465 ÷ 60 = 57 minutes, remainder 45 → 45 seconds Result: 4 hours, 57 minutes, 45 seconds
Worked example — midnight crossing: Start: 11:15 PM → 23:15:00 = 83,700 seconds End: 6:45 AM (next day) → 6 × 3600 + 45 × 60 = 24,300 seconds Elapsed: (24,300 + 86,400) − 83,700 = 27,000 seconds = 7 hours, 30 minutes
Common real-world uses:
- Shift work duration calculations
- Race and competition timing
- Cooking and process timers
- Billing (hourly rate × elapsed hours)
- Productivity tracking