Hours Calculator
Duration8h 0m
Decimal Hours8.00
This hours calculator finds the elapsed time between a start time and an end time, which is handy for working out a shift length, a study session, or how long an event ran. It converts both times to seconds, takes the difference, and breaks the result into whole hours and minutes as well as a decimal-hours figure. The decimal value, such as 8.5 hours, is the form most timesheets and payroll systems expect.
Formula
Decimal hours = |End − Start in seconds| ÷ 3600
- Start
- Start time, converted to seconds since midnight
- End
- End time, converted to seconds since midnight
- 3600
- Seconds in one hour, used to convert the difference to hours
How it works
- Enter the start time and end time in 24-hour HH:MM format (for example, 09:00 and 17:30).
- The calculator converts each time to seconds since midnight and takes the absolute difference between them.
- It splits that difference into hours and minutes and also reports the total as decimal hours, rounded to two places.
Worked example
A work shift that runs from 09:00 to 17:30.
- Start in seconds: 9 × 3600 = 32,400; end in seconds: 17 × 3600 + 30 × 60 = 63,000.
- Difference: 63,000 − 32,400 = 30,600 seconds.
- Convert: 30,600 ÷ 3600 = 8.5 hours, which is 8 hours and 30 minutes.
The shift is 8 hours 30 minutes, or 8.5 decimal hours.
Frequently asked questions
- What time format should I use?
- Enter times in 24-hour HH:MM format, so 5:30 in the afternoon is 17:30. Using the 24-hour clock avoids any AM/PM ambiguity when the calculator converts the times to seconds.
- Does it subtract breaks or unpaid lunch time?
- No. It returns the full span between the two times you enter. To exclude a break, subtract the break length from the result, or enter separate before-break and after-break spans and add them.
- What are decimal hours used for?
- Decimal hours express minutes as a fraction of an hour, so 30 minutes becomes 0.5. Payroll and billing systems usually multiply a decimal-hours figure by an hourly rate, which is why this format is provided alongside hours and minutes.
- Can it handle shifts that cross midnight?
- The calculator takes the absolute difference between the two clock times, so an overnight shift entered as 22:00 to 06:00 returns the gap within a single day rather than spanning midnight. For overnight spans, calculate the time to midnight and after midnight separately and add them.