ThisCalculator

Everyday

Hourly Calculator Between Times: Work Hours

Updated · Standard formula, shown below

Duration 8:00 h:mm
Decimal hours
0.13 h
Result
Start time (HH:MM)
9
You entered
Finish time (HH:MM)
17
You entered

This calculator works out the number of hours and minutes between two times of day, such as a shift start and end time. You enter a start time and a finish time, and you get back the elapsed duration in hours and minutes, plus the same duration expressed as a decimal number of hours. It is designed for work shifts, class schedules, or any situation where you need the time span between a start and an end.

Formula

Both input times are converted to minutes after midnight. The duration in minutes is simply:

Duration (minutes) = Finish time (minutes after midnight) − Start time (minutes after midnight)

If the result is negative, the calculator adds 24 hours (1440 minutes) to account for a shift that crosses midnight. The output shows the duration as hours and minutes (h:mm) and as a decimal number of hours (e.g., 7.50 hours).

Worked Example

Using the default values: start at 9:00 and finish at 17:00.

  1. Convert start time: 9:00 → 9 × 60 = 540 minutes.
  2. Convert finish time: 17:00 → 17 × 60 = 1020 minutes.
  3. Subtract: 1020 − 540 = 480 minutes.
  4. Convert to hours and minutes: 480 ÷ 60 = 8 hours, 0 minutes.
  5. Decimal hours: 480 ÷ 60 = 8.00 hours.

The calculator displays 8:00 as the duration and 8.00 as decimal hours.

When to Use This Calculator

Use this tool any time you need the elapsed time between two clock times. Common situations include:

  • Calculating the length of a work shift for timesheet entry.
  • Finding how long a meeting or class lasted.
  • Determining the duration of a trip or event.
  • Checking how much time remains between two appointments.

For payroll purposes, many employers require decimal hours (e.g., 7.50 instead of 7:30) because that format is easier to multiply by an hourly rate. This calculator gives both, so you can use whichever your system needs.

How to Read the Results

The first output, Duration, is shown as h:mm (e.g., 8:00 means 8 hours and 0 minutes). The second output, Decimal hours, is the same duration expressed as a number with two decimal places (e.g., 8.00). To convert h:mm to decimal hours manually, divide the minutes by 60 and add to the hours: 7 hours 30 minutes → 7 + 30/60 = 7.50.

If your shift crosses midnight (e.g., 23:00 to 07:00), the calculator automatically adds 24 hours to the finish time, so you get 8:00 instead of a negative number. That is correct for any duration that spans midnight.

Common Mistakes and Limitations

  • Using 12-hour vs. 24-hour format: This calculator expects 24-hour times (e.g., 17:00 for 5 PM). If you enter 5:00, it treats that as 5 AM. Convert PM times by adding 12 (except 12 PM itself).
  • Forgetting lunch breaks: The duration is the total elapsed time from start to finish. If a worker takes an unpaid 30-minute lunch, subtract that separately. For example, an 8-hour shift with a 30-minute break is 7.5 paid hours.
  • Rounding too early: When converting to decimal hours, keep at least two decimals. Rounding 7.666… to 7.7 instead of 7.67 can cause small payroll discrepancies.
  • Overnight shifts: Always verify that the calculator added 24 hours for a crossing-midnight shift. If you enter 23:00 and 01:00, the result should be 2:00, not −22:00.

The formula assumes both times are on the same day unless the finish is earlier than the start, in which case it assumes the finish is on the next day. It does not account for time zones, daylight saving changes, or breaks—those are separate adjustments you must make.

Alternative Methods

You can do the same calculation manually with these steps:

  1. Convert each time to minutes after midnight.
  2. Subtract the start minutes from the finish minutes.
  3. If negative, add 1440.
  4. Divide by 60 to get decimal hours.
  5. For h:mm, divide by 60: the quotient is hours, the remainder is minutes.

Spreadsheet users can use the formula =TEXT(B2-A2,"h:mm") in Excel or Google Sheets, where A2 is start and B2 is finish, as long as both cells are formatted as times. That method also handles overnight shifts automatically when the date is included, but if you only enter times, you may need to add 1 to the finish date for overnight shifts.

Frequently Asked Questions

How do I calculate hours between two times including lunch break?

First, calculate the total duration from start to finish using the calculator. Then subtract the break length in minutes. For example, a 9:00–17:30 shift with a 30-minute lunch: total is 8.5 hours, minus 0.5 hours = 8.0 paid hours.

What if my shift starts at 10 PM and ends at 6 AM?

Enter 22:00 for start and 06:00 for finish. The calculator sees that finish is earlier than start, adds 24 hours, and returns 8:00 (8 hours). That is the correct duration.

Why do I get a negative number?

You should not get a negative number if you enter the times correctly. A negative result appears only if the start time is later than the finish time and the calculator did not add 24 hours—but this calculator always adds 24 hours automatically for overnight shifts. If you still see a negative, double-check that you entered the times in 24-hour format.

How do I convert minutes to decimal hours?

Divide the minutes by 60. For example, 45 minutes → 45 ÷ 60 = 0.75 hours. Add that to the whole hours: 7 hours 45 minutes → 7.75 hours.

Is 9:00 to 5:00 eight hours?

Yes, 9:00 AM to 5:00 PM is exactly 8 hours. That is the default example in this calculator. However, if you take a lunch break, the paid hours are less.

Can this calculator handle seconds?

No, it only accepts times in whole minutes (HH:MM). For seconds, convert them to minutes first (e.g., 30 seconds = 0.5 minutes) or use a different tool that supports seconds.

Related

Formula used
in t | Start time (HH:MM) | - | 9 | 0
in d | Finish time (HH:MM) | - | 17 | 0
out dur | Duration | h:mm | d - t | time
out dec | Decimal hours | h | (d - t) / 60 | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.