---
url: https://findutils.com/guides/time-difference-calculator
title: "Calculate Hours Between Two Times, Including Overnight Shifts"
description: "Calculate hours between clock times, including overnight shifts. Subtract a break, compare equal times, and use decimal hours in a timesheet."
category: calculate
content_type: guide
guide_type: subtopic
cluster: time-tools
locale: en
read_time: 5
status: published
author: "olgunozoktas"
published_at: 2026-09-02T12:00:00Z
excerpt: "The gap between two times of day is simple arithmetic until the clock resets at midnight. Review the wrap rule, the equal-times case, and decimal hours for payroll."
tag_ids: ["time", "calculator", "payroll", "shifts", "duration"]
tags: ["Time", "Calculator", "Payroll", "Shifts", "Duration"]
primary_keyword: "time difference calculator"
secondary_keywords: ["hours between two times", "overnight shift calculator", "decimal hours calculator", "how many hours between", "work hours calculator"]
tool_tag: "time-difference-calculator"
related_tool: "time-difference-calculator"
related_tools: ["time-difference-calculator", "date-difference-calculator", "timesheet-calculator"]
updated_at: "2026-09-08T09:09:24Z"
og_image: "/images/content/guides/time-difference-overnight-shift.webp"
image_alt: "A clock path crosses from night to morning before it reaches a payroll sheet."
---

Work out the gap between two times of day with FindUtils [Time Difference Calculator](/calculate/time-difference-calculator/). It handles a shift that runs past midnight, subtracts an unpaid break, and gives the answer as decimal hours for a timesheet. Everything runs in your browser.

This guide is about the three cases where the obvious arithmetic gives the wrong answer.

## Case 1: The Clock Resets

From 09:00 to 17:30 the subtraction works: eight and a half hours.

From 22:00 to 06:00 it does not. The end is a *smaller* number than the start, so `06:00 − 22:00` gives **minus sixteen hours**. The real answer is eight.

The fix is to notice the end fell on the next day and add twenty-four hours. That is the entire job, and it is why this tool exists separately from a date calculator: with two bare clock readings there is no date to tell you which day the end belongs to.

The setting has three positions rather than a checkbox, because the three cases genuinely differ:

| Mode | Behaviour | Use when |
|---|---|---|
| **Auto** | wraps only when the end is not after the start | almost always — this is the default |
| **Always** | treats the end as the next day regardless, so 09:00 to 17:00 is **32 hours** | a long shift where both times look like a normal day |
| **Never** | refuses to wrap and reports an error | you want to be told you typed the times the wrong way round |

## Case 2: Two Equal Times

A shift from 09:00 to 09:00 is **twenty-four hours**, not zero.

Plenty of calculators return zero here, and it is the worst kind of wrong: it looks plausible, it passes review, and it silently removes a whole day from a timesheet. Nobody catches it until payroll.

## Case 3: The Twelve-Hour Clock

`12:00 am` is midnight. `12:00 pm` is noon.

Neither is "twelve o'clock plus an offset", so the common shortcut — add twelve to the hour when it says pm — gets both of them wrong, and they are the two values people most often type. Both are handled here.

## Decimal Hours

Under the main answer sits the same duration as a single number, because that is what the next step usually needs.

**Eight hours and thirty minutes is 8.5, not 8.3.**

That slip is common and it is expensive: it under-reports by twelve minutes on every entry. Any duration whose minutes are not a multiple of six produces a decimal that does not resemble the minutes at all — 8h 20m is 8.33, 8h 50m is 8.83.

## Check the Result With a Known Case

Use a known case before you copy many results into payroll software.

| Start | End | Break | Mode | Expected result |
|---|---|---:|---|---|
| 09:00 | 17:30 | 30 minutes | Auto | 8 hours |
| 22:00 | 06:00 | 30 minutes | Auto | 7 hours 30 minutes |
| 09:00 | 09:00 | 0 minutes | Auto | 24 hours |
| 12:00 am | 12:00 pm | 0 minutes | Auto | 12 hours |

If this check gives a different result, review the clock format and the overnight mode. Do not copy the value to payroll first.

## Which Tool for Which Job

| You have | Use |
|---|---|
| Two clock times, no dates | [Time Difference Calculator](/calculate/time-difference-calculator/) |
| Two dates, or two full date-times | [Date Difference Calculator](/calculate/date-difference-calculator/) |
| A week of entries with overtime and pay | [Timesheet Calculator](/finance/timesheet-calculator/) |

The date calculator accepts ISO 8601 values such as `2026-01-01T09:30`, so it counts the time of day too. What it cannot do is wrap past midnight — with real dates it never needs to, and with bare clock times it has nothing to wrap from.

## Common Mistakes

### Mistake 1: Subtracting Overnight Times by Hand

`06:00 − 22:00` is minus sixteen. If a spreadsheet column shows negative shifts, this is why.

### Mistake 2: Reading 8h 30m as 8.3

It is 8.5. See above.

### Mistake 3: Forgetting the Unpaid Break

A half-hour lunch inside a 09:00 to 17:30 shift makes it eight hours, not eight and a half. Put it in the Break field.

### Mistake 4: Using Always by Default

Always adds a day unconditionally, so a normal 09:00 to 17:00 becomes thirty-two hours. Leave it on Auto unless you know the end really is the next day.

## Tools Used in This Guide

- [Time Difference Calculator](/calculate/time-difference-calculator/) — this tool.
- [Date Difference Calculator](/calculate/date-difference-calculator/) — when dates are involved.
- [Timesheet Calculator](/finance/timesheet-calculator/) — a week of entries with pay.
- [Timezone Converter](/productivity/timezone-converter/) — when the two times are in different zones.

## FAQ

**How do I calculate hours across midnight?**
Enter the times and leave the mode on Auto. It adds a day when the end is not after the start.

**What does 09:00 to 09:00 give?**
Twenty-four hours. Two equal times mean a full day.

**What are decimal hours?**
The duration as one number for payroll: 8h 30m is 8.5.

**Can I subtract a lunch break?**
Yes, in the Break field. A break longer than the shift is rejected rather than going negative.

**Does it accept am and pm?**
Yes, and it puts 12:00 am at midnight and 12:00 pm at noon.

**What if my times are on different dates?**
Use the Date Difference Calculator, which takes full date-times.

## Next Steps

Feed the decimal hours into [Timesheet Calculator](/finance/timesheet-calculator/) for a full week with overtime, or use [Timezone Converter](/productivity/timezone-converter/) first if the two times were recorded in different zones.
