Time Duration Calculator

Calculate the exact duration between two times, including overnight ranges.

This tool runs entirely in your browser. Your files are never uploaded to a server.

8h 30m

Duration

8.50

Decimal hours

510

Total minutes

30,600

Total seconds

What this tool does

Calculates the exact duration between a start time and an end time on the same day, or overnight if the end time falls after midnight, and shows the result as hours and minutes, decimal hours, total minutes, and total seconds.

How to use it

Enter a start time and an end time, and check "End time is next day" if the end time is on the following day (for an overnight shift, for example). Reset returns to the default example of 09:00 to 17:30.

Worked example

From 09:00 to 17:30 on the same day gives a duration of 8h 30m — that's 8.50 decimal hours, 510 total minutes, and 30,600 total seconds. Checking "End time is next day" for a shift from 22:00 to 06:00 instead gives 8h 0m, since the calculator adds 24 hours to the end time before subtracting.

Method

Both times are parsed as hours and minutes since midnight (0 to 1,439). If "End time is next day" is checked, 1,440 minutes (24 hours) are added to the end time before subtracting the start time; the four displayed figures — hours/minutes, decimal hours, total minutes, and total seconds — are all derived from that single minute difference.

Overnight ranges

The next-day checkbox is what makes overnight ranges possible: without it, an end time earlier than the start time (like 06:00 after a 22:00 start) is treated as invalid rather than assumed to be the next day, since the tool can't otherwise tell whether you made an entry mistake or genuinely meant a range spanning midnight.

Limitations

This only handles times of day, not full dates, and only accounts for at most one midnight crossing — it can't calculate a duration spanning two or more full days. It also doesn't account for time-zone changes or daylight-saving transitions, since both times are treated as plain clock values with no date attached.

Privacy and processing

The calculation runs entirely in your browser using JavaScript. The times you enter are never uploaded or stored.

Frequently Asked Questions

How do I calculate an overnight duration, like a night shift?
Check "End time is next day" whenever the end time is earlier in the clock than the start time but actually falls on the following day — the tool then adds 24 hours to the end time before calculating.
What do the four result figures mean?
Hours and minutes (like 8h 30m) is the human-readable duration; decimal hours (8.50) is useful for timesheets; total minutes and total seconds give the same duration in smaller units.
What happens if the end time is earlier than the start time and the box isn't checked?
The tool shows an error instead of guessing, since it can't tell whether you mistyped a time or meant a range that crosses midnight.
Can I calculate a duration spanning more than one full day?
No, this handles same-day and single-overnight ranges only. For multi-day spans, use the Date Difference Calculator or Add or Subtract Time Calculator instead.