ThisCalculator

Everyday

Time Converter Between Two Times

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.

This time converter calculates the exact duration between two times of day, whether they fall on the same day or span midnight. You enter a start time and an end time (with optional dates), and the tool returns the difference in hours, minutes, and seconds, plus the total minutes and decimal hours. It is designed for shift planning, travel itineraries, and any situation where you need a precise elapsed time.

Formula

The core formula converts both times to minutes since midnight, subtracts them, and adds the day difference in minutes:

Duration (minutes) = (End date − Start date) × 1440 + (End hours × 60 + End minutes) − (Start hours × 60 + Start minutes)

  • Start time – hours and minutes (0–23, 0–59) using a 24-hour clock.
  • End time – same format as start.
  • Start date – optional, but required when the end time is on a different day.
  • End date – optional; defaults to the start date if omitted.
  • 1440 – the number of minutes in one day (24 × 60).

The result is given in minutes, decimal hours (e.g., 8.5 hours), and a human-readable h:mm:ss format (e.g., 8:30:00).

Worked Example

Using the default values: start at 09:00 on 2025-01-01, end at 17:30 on the same day.

  1. Convert start time to minutes: 9 × 60 + 0 = 540 minutes.
  2. Convert end time to minutes: 17 × 60 + 30 = 1050 minutes.
  3. Day difference: (2025-01-01 − 2025-01-01) = 0 days, so 0 × 1440 = 0 minutes.
  4. Duration in minutes: 1050 − 540 + 0 = 510 minutes.
  5. Decimal hours: 510 / 60 = 8.5 hours.
  6. Display: 510 minutes = 8 hours and 30 minutes, shown as 8:30:00.

How the Conversion Works

Time conversion between two clock times relies on a consistent unit: minutes. Every time is first expressed as minutes after midnight (00:00). For example, 14:45 becomes 14 × 60 + 45 = 885 minutes. The difference between two times is simply the subtraction of these minute values. When the time spans midnight, the date difference is added in days, each contributing 1440 minutes. This method avoids common errors like trying to subtract hours and minutes separately without borrowing.

If you only need the time difference within the same day, the date fields can be ignored. But if you work night shifts or track overnight processes, including the dates ensures the result is positive and correct.

When to Use This Converter

  • Work shifts – Calculate hours worked from clock-in to clock-out, even across midnight.
  • Travel planning – Determine flight duration or driving time between departure and arrival.
  • Project tracking – Measure how long a task took from start to finish.
  • Cooking and baking – Time a recipe that starts in the evening and ends the next morning.
  • Fitness – Track rest periods or workout durations.

The result is a pure elapsed time, not a time of day. For example, if you start at 23:00 and end at 01:30 the next day, the duration is 2.5 hours, not 1:30.

Common Mistakes and How to Avoid Them

  • Mixing 12-hour and 24-hour formats – Always use a 24-hour clock (e.g., 3:00 PM becomes 15:00). If you enter 3:00 intending PM, the calculator will read it as 3 AM.
  • Forgetting the date when crossing midnight – If you enter 22:00 and 02:00 without dates, the calculator subtracts and gets −20 hours, which is negative. Adding the correct dates (e.g., 2025-01-01 and 2025-01-02) gives the correct 4 hours.
  • Confusing decimal hours with h:mm – 1.5 hours is 1 hour 30 minutes, not 1 hour 50 minutes. The decimal hours output (e.g., 8.5) is useful for payroll, but the h:mm:ss display is clearer for most purposes.
  • Ignoring seconds – If your start or end time includes seconds, convert them to a decimal fraction of a minute (e.g., 15 seconds = 0.25 minutes) before entering, or use a tool that accepts seconds directly.

Limitations of the Formula

This converter assumes a linear, continuous time scale. It does not account for:

  • Time zones – If start and end are in different time zones, you must first convert both to the same zone (e.g., UTC) before calculating.
  • Daylight saving time changes – On days when clocks spring forward or fall back, the actual elapsed time may differ by an hour from the simple arithmetic. The converter uses standard 24-hour days.
  • Leap seconds – These are occasionally added to UTC, but they are irrelevant for everyday time differences.
  • Negative durations – If the end time is earlier than the start time and the dates are the same, the result is negative. Always include the correct dates for overnight spans.

For most practical purposes, the formula is exact. For scientific or astronomical use, consult a specialized time standard.

Alternatives and Related Calculations

If you need to convert a single time between time zones, this tool is not the right one – you would use a time zone converter. For adding or subtracting a duration from a specific time (e.g., “What time is 2 hours after 3 PM?”), a time arithmetic calculator is more suitable. The formula here is the foundation for those tools, but they require different inputs.

You can also perform this calculation manually in a spreadsheet: if A1 is start time and B1 is end time (formatted as times), use =(B1-A1)*24 for decimal hours, or =TEXT(B1-A1,"h:mm") for h:mm display, ensuring the cells are formatted correctly.

Frequently Asked Questions

How do I convert between 12-hour and 24-hour time?

To convert from 12-hour to 24-hour: for times between 1:00 AM and 12:59 PM, keep the same hour (but 12 AM becomes 0). For times between 1:00 PM and 11:59 PM, add 12 to the hour. For example, 3:45 PM becomes 15:45, and 12:30 AM becomes 00:30.

What if my end time is before my start time?

If the end time is earlier on the same day, the duration is negative, which usually means the end time is on the next day. Enter the correct end date (e.g., the day after the start date) to get a positive result. For example, 23:00 to 01:00 with end date one day later gives 2 hours.

Can I use this for time zones?

No, this converter works only with times in the same time zone. To find the duration between two events in different zones, first convert both to UTC (or any common zone), then use this calculator with those converted times and dates.

How do I convert decimal hours to hh:mm?

Take the decimal part and multiply by 60. For example, 8.75 hours: 0.75 × 60 = 45 minutes, so 8.75 hours is 8 hours 45 minutes. The calculator does this automatically in the h:mm:ss output.

Why does the calculator show a negative number?

A negative result means the end time is earlier than the start time on the same date. Check that the end date is set correctly – if the event crosses midnight, the end date should be the following day.

Does this account for daylight saving time?

No. The calculator assumes every day has exactly 24 hours. On days when DST starts or ends, the actual elapsed time may be 23 or 25 hours. For payroll or legal purposes, check local regulations on how to handle DST transitions.

Related

Formula used
in t_start | Start time (HH:MM) | - | 09:00 | 0
in t_end | End time (HH:MM) | - | 17:30 | 0
in d_start | Start date (YYYY-MM-DD) | - | 2025-01-01 | 0
in d_end | End date (YYYY-MM-DD) | - | 2025-01-01 | 0
out dur_min | Duration (minutes) | min | ((d_end - d_start) * 1440) + (t_end_hour * 60 + t_end_min) - (t_start_hour * 60 + t_start_min) | 1
out dur_hours | Duration (decimal hours) | h | dur_min / 60 | 2
out dur_display | Duration (h:mm:ss) | - | dur_min * 60 | 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.