Hours Calculator

Calculate the hours between two times, in 12-hour (AM/PM) or 24-hour format. Results in duration (h:m:s), decimal hours, minutes and seconds.

: :
: :

Duration

Hours

Minutes

Seconds

How to Use the Hours Calculator

Choose 12-hour (AM/PM) or 24-hour format and enter a start time and an end time. From 9:00 AM to 5:30 PM the hours calculator returns 8 hours and 30 minutes, which is 8.5 decimal hours, 510 minutes, and 30600 seconds. If the end time is earlier than the start, the span crosses midnight: 10:00 PM to 6:00 AM is 8 hours. Check the box to include seconds.

How to Calculate Hours Between Two Times

Subtract the start time from the end time. Time uses a base-60 system, not base 10: if the end minutes are smaller than the start minutes, borrow 1 hour (60 minutes). Decimal hours are the minutes divided by 60. 8 hours and 45 minutes is 8.75 hours, not 8.45. 15 minutes = 0.25 hours, 30 minutes = 0.5 hours, and 45 minutes = 0.75 hours.

In 24-hour format

To calculate the hours between two times in 24-hour format:

  1. If the end time is earlier than the start time (the span crosses midnight), add 24 hours to the end time.
  2. Subtract the minutes. If the end minutes are smaller than the start minutes, borrow 1 hour (60 minutes) from the end hours and add it to the minutes.
  3. Subtract hours and minutes separately: that pair is the duration.

For example, the hours from 22:30 to 01:15 the next day:

  • Midnight crossing: add 24 hours to 01:15, turning it into 25:15.
  • Base-60 adjustment: since 15 is smaller than 30, borrow 1 hour (25 h becomes 24 h and the minutes become 15 + 60 = 75). This leaves 24:75, an auxiliary form for subtraction, not a clock time.
  • Subtract separately: 75 − 30 = 45 minutes and 24 − 22 = 2 hours. The duration is 2 hours and 45 minutes, or 2.75 decimal hours.

In 12-hour format (AM/PM)

The extra work is the conversion. Switch both times to 24-hour format, then subtract:

  1. For AM times: keep the hour the same, except for 12:00 AM, which converts to 00:00.
  2. For PM times: add 12 to the hour (for example, 5 PM = 17:00), except for 12:00 PM, which stays at 12:00.
  3. Once both times are in 24-hour format, subtract as in the previous method. Only if the end minutes are smaller, borrow 1 hour (60 minutes).

For example, the hours from 8:45 AM to 5:15 PM:

  • Convert to 24-hour: 8:45 AM stays 08:45, and 5:15 PM becomes 17:15 (5 + 12).
  • The end minutes are smaller (15 is less than 45), so borrow 1 hour: 17:15 becomes 16:75.
  • Subtract separately: 75 − 45 = 30 minutes and 16 − 8 = 8 hours. The duration is 8 hours and 30 minutes, or 8.5 decimal hours. It is not 8.45.

How to Calculate Hours Between Two Times in Excel

Excel stores each time as a fraction of a day, including seconds. The formulas below subtract two cells; the cell format decides whether you see a clock or a number. A clock reading of 8:30 is 8.5 decimal hours, not 8.30.

  • Duration in clock format: With the start time in A2 and the end time in B2, use =MOD(B2-A2, 1). The formula already keeps the seconds; what changes is the custom cell format: [h]:mm for hours and minutes, or [h]:mm:ss if you also want to see the seconds. It works for the same day and for shifts that cross midnight, without negative-number errors.
  • Duration in decimal hours: To get an operable number (for example, 8.5 instead of 08:30), multiply the calculation by 24: =MOD(B2-A2, 1)*24 and set the cell format to Number.
  • Duration in total minutes: To find the total minutes (for example, 510 instead of 08:30), multiply the result by 1440 (the minutes in a full day): =MOD(B2-A2, 1)*1440 and set the cell format to Number.

What Do AM and PM Stand For?

They divide the day into two 12-hour periods: AM (from Latin ante meridiem, "before midday") runs from midnight to 11:59 AM, and PM (from Latin post meridiem, "after midday") runs from noon to 11:59 PM. In this hours calculator, picking the correct designation for each time is essential: if you choose 11:45 PM as the start and 12:20 AM as the end, the tool detects the midnight crossing and returns a 35-minute duration. Keep the most common pitfall in mind: 12:00 AM is midnight (00:00) and 12:00 PM is noon (12:00); confusing them shifts your result by 12 hours.