Time Duration Calculator

Shift workers, pilots, students and anyone tracking elapsed time need the difference between two clock times — even when the shift crosses midnight. This calculator takes a start time and an end time (each as hour, minute, second) and returns the duration as a readable string (e.g. '8h 30m 0s'), plus total seconds, minutes and hours. Overnight wrap is automatic: 22:00 to 02:00 correctly gives 4 hours.

Enter values

Start hour (0–23)

Start minute (0–59)

Start second (0–59)

End hour (0–23)

End minute (0–59)

End second (0–59)

Results update as you type.

Results

Duration
8h 30m 0s
Total seconds
30,600
Total minutes
510
Total hours
8.5

How is the Time Duration calculated?

Enter the start hour (0–23), minute (0–59) and second (0–59), then the end hour, minute and second. If the end time is earlier than or equal to the start time, the calculator assumes the end is on the following day and adds 24 hours. The result is formatted as 'Xh Ym Zs' and also shown as decimal hours and minutes for payroll or billing.

Formula

Start seconds = H₁×3600 + M₁×60 + S₁. End seconds = H₂×3600 + M₂×60 + S₂. If end ≤ start, end += 86,400. Duration = end − start seconds. Formatted as hours, minutes, seconds. Total minutes = duration ÷ 60. Total hours = duration ÷ 3,600.

Example

Start 09:00:00, end 17:30:00: duration = 8h 30m 0s, total seconds = 30,600, total minutes = 510, total hours = 8.50. Start 22:00:00, end 02:00:00: end ≤ start so end becomes 26:00:00, duration = 4h 0m 0s, total seconds = 14,400. Start 23:15:30, end 00:45:15: end ≤ start so end becomes 24:45:15, duration = 1h 29m 45s, total seconds = 5,385, total minutes = 89.75.

Things to remember

The overnight wrap makes this suitable for night shifts. For multi-day durations, use the date-difference calculator for days and this one for the time-of-day portion. The decimal hours output feeds directly into payroll or billing systems.

Frequently Asked Questions

How does the calculator handle overnight shifts?

If the end time is earlier than or equal to the start time, it adds 24 hours to the end time before subtracting. So 22:00 to 02:00 becomes 22:00 to 26:00 = 4 hours.

What if start and end times are identical?

The calculator treats this as a full 24-hour period (86,400 seconds), assuming you mean 'same time tomorrow'. For a zero-length duration, use the date-difference calculator with the same date.

Can I calculate a duration longer than 24 hours?

No — this calculator only handles two times of day. For multi-day durations, use the date-difference calculator for whole days and add this calculator's result for the partial day at each end.

Why are seconds included in the inputs?

Some timing applications (sports, lab work, media) need second precision. If you only need hours and minutes, enter 0 for seconds.