TimeKit
All Articles
Guide7 min readJuly 15, 2026

How to Calculate Hours Between Two Times

Learn how to calculate hours and minutes between two times, including overnight shifts, unpaid breaks, decimal hours, and daylight saving changes.

How to Calculate Hours Between Two Times editorial illustration

To calculate hours between two times, convert both times to minutes after midnight, subtract the start from the end, and convert the result back to hours and minutes. Overnight shifts need one extra step because the ending time falls on the next calendar day.

The Basic Formula

For a time written as hours and minutes:

total minutes = hours × 60 + minutes

Then calculate:

duration minutes = end minutes - start minutes

For 9:20 AM to 2:50 PM, first use 24-hour time:

  • 9:20 becomes 9 × 60 + 20 = 560 minutes
  • 14:50 becomes 14 × 60 + 50 = 890 minutes
  • 890 - 560 = 330 minutes
  • 330 minutes = 5 hours 30 minutes

Convert 12-Hour Time Correctly

Before subtracting, convert PM hours to 24-hour time.

  • Keep AM hours from 1 through 11
  • Change 12 AM to 00
  • Keep 12 PM as 12
  • Add 12 to PM hours from 1 through 11

For example, 6:45 PM becomes 18:45.

The most common mistake is treating 12 AM and 12 PM like ordinary hours. Midnight is 00:00 in 24-hour time, while noon is 12:00.

Calculate an Overnight Shift

Suppose a shift begins at 10:30 PM and ends at 6:15 AM.

  • Start: 22 × 60 + 30 = 1,350 minutes
  • End: 6 × 60 + 15 = 375 minutes

The ending value is smaller because it belongs to the next day. Add 1,440 minutes, the length of a 24-hour day, to the end:

  • Adjusted end: 375 + 1,440 = 1,815
  • Duration: 1,815 - 1,350 = 465 minutes
  • Result: 7 hours 45 minutes

A quick rule is: if the end time is earlier than the start time, treat the end as part of the following day.

Subtract Breaks

Calculate the full elapsed time first, then subtract unpaid breaks.

A workday from 8:30 AM to 5:15 PM lasts 8 hours 45 minutes. If it includes a 45-minute unpaid lunch:

  • Full duration: 525 minutes
  • Break: 45 minutes
  • Paid time: 480 minutes
  • Result: 8 hours

Keep every value in minutes until the last step. Mixing hours and minutes during subtraction causes avoidable errors.

Convert Minutes to Decimal Hours

Payroll and billing systems often use decimal hours.

Divide the remaining minutes by 60:

  • 15 minutes = 0.25 hour
  • 30 minutes = 0.50 hour
  • 45 minutes = 0.75 hour
  • 20 minutes = 0.333 hour
  • 40 minutes = 0.667 hour

A duration of 7 hours 45 minutes is 7.75 hours, not 7.45 hours. The digits after the decimal represent a fraction of an hour, not clock minutes.

Add Several Time Blocks

For split shifts or project logs, calculate each block separately in minutes.

Example:

  • 8:10 AM to 11:55 AM = 225 minutes
  • 1:05 PM to 4:40 PM = 215 minutes
  • Total = 440 minutes
  • Result = 7 hours 20 minutes

This method also works for study sessions, travel legs, machine runtime, and client billing.

Daylight Saving Time Can Change the Answer

A normal civil day has 24 hours, but a daylight saving transition may create a 23-hour or 25-hour day.

If an interval crosses a clock change, wall-clock subtraction can be wrong. Use:

  • The full date
  • The local time
  • The named time zone
  • A date-time library or calculator that understands daylight saving rules

For example, 1:30 AM to 3:30 AM may represent only one elapsed hour when the clock jumps forward at 2:00 AM.

UTC timestamps avoid this ambiguity because they identify absolute instants.

Rounding for Payroll or Billing

Some organizations round to the nearest 5, 6, 10, or 15 minutes. Apply rounding only after confirming the policy.

Record the original start, end, and break times first. Then calculate the exact duration. A separate rounding step makes the result easier to audit.

A Checklist for Accurate Results

Before accepting the answer, check:

  • Are both times on the same date?
  • Did the interval cross midnight?
  • Were AM and PM converted correctly?
  • Should breaks be subtracted?
  • Is the result needed as hours and minutes or decimal hours?
  • Did a daylight saving transition occur?
  • Does a rounding rule apply?

Using minutes as the common unit handles ordinary and overnight calculations cleanly. Add the date and time zone when the interval crosses a calendar or daylight saving boundary.

#hours between times#time duration#work hours