Time Duration Calculator — Hours, Minutes & Seconds Between Times
This time duration calculator finds the exact number of hours, minutes, and seconds between any two clock times. Enter a start time and an end time — overnight and cross-midnight periods are handled automatically. Results are shown in HH:MM:SS format, as decimal hours, and as total minutes and seconds, making it ideal for payroll, billing, shift scheduling, and time tracking.
Calculate Time Between Two Times
Enter a start time and end time to calculate the exact duration in hours, minutes, and seconds. Cross-midnight durations are detected automatically.
Duration (HH:MM:SS)
08:00:00
Decimal Hours
8.0000
Total Minutes
480
Total Seconds
28,800
Frequently Asked Questions
How do I calculate the duration between two times?
Subtract the start time from the end time. Convert both times to total seconds since midnight (hour × 3600 + minute × 60 + second), then subtract. Convert the result back to hours, minutes, and seconds. Our calculator does this instantly as you type.
How do I calculate time duration that crosses midnight?
When the end time is earlier than the start time — for example, 22:00 to 06:30 — add 24 hours (86,400 seconds) to the end time before subtracting. This gives the correct overnight duration of 8 hours 30 minutes. The calculator detects cross-midnight periods automatically.
What is the difference between decimal hours and HH:MM:SS?
HH:MM:SS format shows hours, minutes, and seconds as separate integers (e.g., 01:30:00 for 1 hour 30 minutes). Decimal hours express the same duration as a single number (1.5 hours). Decimal hours are widely used in payroll, billing, and time-tracking software.
How do I convert minutes to decimal hours?
Divide the minutes by 60. For example, 45 minutes ÷ 60 = 0.75 decimal hours. For a duration of 2 hours and 45 minutes, the decimal equivalent is 2 + (45 ÷ 60) = 2.75 hours.
How long is a standard work shift?
A standard full-time work shift is 8 hours (09:00 to 17:00). A half-shift is 4 hours. Night shifts commonly run 8 hours from 22:00 to 06:00. Overtime typically applies after 8 hours per day or 40 hours per week, depending on jurisdiction.
How do I calculate billable hours between two times?
Enter your start and end times to get the duration in decimal hours. Multiply the decimal hours by your hourly rate to calculate billable amounts. For example, 2.5 decimal hours at $100/hour = $250.
Can I calculate time duration without seconds?
Yes — leave the seconds field at 0 (the default) and enter only the hours and minutes. The calculator treats missing seconds as zero, so entering start 09:00 and end 17:30 correctly shows a duration of 08:30:00.
How many seconds are in an hour, and how many minutes are in an hour?
There are 60 minutes in one hour and 3,600 seconds in one hour (60 minutes × 60 seconds). One minute equals 60 seconds. These conversions are the basis for all time duration calculations.
How to Calculate Time Duration
Duration Formula
The time duration between two clock times is calculated by converting each time to total seconds since midnight, then subtracting:
startSeconds = startHour × 3600 + startMinute × 60 + startSecond
endSeconds = endHour × 3600 + endMinute × 60 + endSecond
totalSeconds = endSeconds − startSeconds
hours = floor(totalSeconds / 3600)
minutes = floor((totalSeconds mod 3600) / 60)
seconds = totalSeconds mod 60
Example: From 09:30:15 to 14:45:30. Start = 9 × 3600 + 30 × 60 + 15 = 34,215 s. End = 14 × 3600 + 45 × 60 + 30 = 53,130 s. Total = 53,130 − 34,215 = 18,915 s. Result: 5 h 15 m 15 s → 05:15:15.
To convert the total duration to decimal hours, divide the total seconds by 3,600. For example, 5 hours and 30 minutes equals 5.5 decimal hours (19,800 ÷ 3,600 = 5.5).
Cross-Midnight Handling
When the end time is earlier than the start time (for example, start 22:00 and end 06:30), the calculator automatically assumes the period spans across midnight. It adds 24 hours (86,400 seconds) to the end time before subtracting:
if endSeconds < startSeconds:
endSeconds += 86400 # add 24 hours
totalSeconds = endSeconds − startSeconds
Example:Night shift from 22:00 to 06:30. End (23,400 s) < Start (79,200 s), so add 86,400: endSeconds = 109,800. Total = 109,800 − 79,200 = 30,600 s = 8 hours 30 minutes.
This approach works for any shift or period spanning midnight but assumes the gap is less than 24 hours. For durations across multiple days, add the individual day segments.
Common Duration Reference Table
Here are frequently used work shifts and activity durations for quick reference:
| Scenario | Start | End | Duration | Decimal Hours |
|---|---|---|---|---|
| Standard workday | 09:00 | 17:00 | 08:00:00 | 8.0000 |
| Half day | 09:00 | 13:00 | 04:00:00 | 4.0000 |
| Night shift | 22:00 | 06:00 | 08:00:00 | 8.0000 |
| Lunch break | 12:00 | 13:00 | 01:00:00 | 1.0000 |
| Feature film | 19:30 | 21:48 | 02:18:00 | 2.3000 |
| Marathon (avg) | 07:00 | 11:30 | 04:30:00 | 4.5000 |
| Overnight flight | 23:45 | 07:15 | 07:30:00 | 7.5000 |
| Full day (midnight to midnight) | 00:00 | 23:59:59 | 23:59:59 | 23.9997 |
Decimal hours are commonly used in payroll, billing, and time-tracking systems.