ThisCalculator

Everyday

Calculate Time Between Two Times: Formula & Guide

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

Calculate Time Between Two Times: Formula & Guide

This calculator works out the duration between two times of day, such as 9:30 AM and 5:45 PM, and returns the elapsed time in hours and minutes. Enter the start time, the end time, and whether each is AM or PM, and you get the exact difference. The result is shown as a clock-style duration (e.g., 8h 15m), which is the number you need for scheduling, payroll, or travel planning.

Formula

The basic formula for the time between two times is:

Elapsed time = End time − Start time

But because we use a 12-hour or 24-hour clock, you must first convert both times to minutes after midnight. For example, 9:30 AM becomes 9 × 60 + 30 = 570 minutes. 5:45 PM becomes 17 × 60 + 45 = 1065 minutes (since 5:45 PM is 17:45 on a 24-hour clock). Then subtract: 1065 − 570 = 495 minutes, which is 8 hours and 15 minutes.

If the end time is earlier than the start time (e.g., 10:00 PM to 6:00 AM), the duration crosses midnight. In that case, add 24 hours (1440 minutes) to the end time before subtracting. The formula becomes:

Elapsed time = (End time + 1440) − Start time (when crossing midnight)

In the calculator, the expression ((end/60) - (start/60) + 1440) % 1440 handles both cases: it adds 1440 minutes to the difference, then takes the remainder when divided by 1440, which automatically wraps around midnight.

Worked Example

Using the default values from the calculator: start time = 9:30 AM, end time = 5:45 PM.

  1. Convert start time to minutes: 9 × 60 + 30 = 570 minutes.
  2. Convert end time to minutes: 17 × 60 + 45 = 1065 minutes.
  3. Subtract: 1065 − 570 = 495 minutes.
  4. Convert to hours and minutes: 495 ÷ 60 = 8 hours with a remainder of 15 minutes.

So the time between 9:30 AM and 5:45 PM is 8 hours and 15 minutes, which is what the calculator shows.

How to Use the Calculator

Enter the start time and end time in 24-hour format (HH:MM) or use AM/PM if your browser supports it. The calculator accepts times like 9:30, 17:45, or 12:00. If you enter 12:00 for noon, it is treated as 12:00 (midday). If you enter 00:00, it is midnight. The result is always a positive duration, even if the end time is before the start time, because the calculator assumes you mean the next day.

For example, if you start work at 10:00 PM and finish at 6:00 AM the next day, enter 22:00 and 6:00. The calculator returns 8 hours, which is correct for an overnight shift.

Common Mistakes and How to Avoid Them

  • Mixing AM and PM incorrectly: 12:00 AM is midnight (00:00), not noon. 12:00 PM is noon (12:00). If you enter 12:00 AM as start and 12:00 PM as end, the result is 12 hours, not 0.
  • Forgetting the midnight wrap: If you subtract 22:00 from 6:00 directly, you get −16 hours. The calculator adds 24 hours automatically, but if you do it manually, remember to add 1440 minutes when the end is earlier.
  • Using decimal hours incorrectly: 1.5 hours is 1 hour and 30 minutes, not 1 hour and 50 minutes. Always convert the fractional part by multiplying by 60.
  • Rounding too early: If you round minutes to the nearest 10, you might get 8h 20m instead of 8h 15m. Keep full precision until the final step.

When to Use This Formula

This formula is used in many everyday situations:

  • Work hours: Calculate how long you worked from clock-in to clock-out.
  • Travel time: Estimate how long a journey takes from departure to arrival.
  • Cooking: Determine when a dish will be ready if you start at a given time.
  • Sports: Measure the duration of an event or race.
  • Billing: Calculate time spent on a task for invoicing.

For durations longer than 24 hours, you need to add the number of days separately. For example, if you start on Monday at 9:00 AM and end on Wednesday at 5:00 PM, the time between is 2 days and 8 hours (56 hours total). The calculator only handles durations within a single 24-hour cycle.

Alternative Methods

If you don’t have a calculator, you can also use these methods:

  • Mental arithmetic: Count hours from start to end, then adjust minutes. For example, from 9:30 to 5:45: 9:30 to 5:30 is 8 hours, plus 15 minutes = 8h 15m.
  • Spreadsheet software: In Excel or Google Sheets, you can subtract two time cells directly if they are formatted as times. For example, =B1-A1 gives the difference in days, which you can format as hours and minutes.
  • Online time duration calculators: Many websites offer similar tools, but this one uses the same standard formula.

Limitations of the Formula

The formula assumes a linear, continuous time scale. It does not account for:

  • Time zones: If start and end are in different time zones, you must convert them to the same zone first.
  • Daylight saving time changes: On days when clocks change, the actual elapsed time may be 23 or 25 hours, but the formula still gives the clock difference.
  • Leap seconds: These are rare and usually ignored for everyday calculations.
  • Fractions of a second: The calculator works in whole minutes. If you need seconds, convert everything to seconds first.

Frequently Asked Questions

How do I calculate time between two times in Excel?

In Excel, put the start time in cell A1 and the end time in B1. In C1, enter =B1-A1 and format the cell as h:mm. If the end time is before the start time (crossing midnight), use =IF(B1>A1, B1-A1, 1+B1-A1) to add a day.

What if the end time is earlier than the start time?

That usually means the duration crosses midnight. For example, from 10:00 PM to 2:00 AM is 4 hours. The calculator automatically adds 24 hours to the end time in that case. If you are doing it manually, add 24 hours to the end time before subtracting.

How do I convert minutes to hours and minutes?

Divide the total minutes by 60. The whole number is the hours, and the remainder is the minutes. For example, 495 minutes ÷ 60 = 8 with a remainder of 15, so it’s 8 hours and 15 minutes.

Is 12:00 AM midnight or noon?

12:00 AM is midnight (the start of the day). 12:00 PM is noon. This is a common source of error. In 24-hour format, midnight is 00:00 and noon is 12:00.

Can I calculate the time between two times that are more than 24 hours apart?

Yes, but you need to include the number of days. For example, from Monday 9:00 AM to Wednesday 5:00 PM is 2 days and 8 hours. The basic formula only works for durations within a single day; for longer periods, multiply the number of days by 24 and add the hours.

Does the formula account for time zones?

No. The formula works on the times as entered. If the start and end times are in different time zones, convert them to the same time zone first. For example, if a flight departs at 10:00 AM EST and arrives at 1:00 PM PST, convert 1:00 PM PST to 4:00 PM EST before subtracting, giving 6 hours.

Related

Formula used
in start | Start time (HH:MM) | - | 9:30 | 0
in end | End time (HH:MM) | - | 17:45 | 0
out diff | Time between | h:mm | ( (end/60) - (start/60) + 1440 ) % 1440 | time

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.