Time calculator

Find the duration between two times, or add and subtract hours and minutes from a time.

✓ 100% free✓ No signup✓ Instant results

Time duration between two times

Total duration
Decimal hours
Total minutes

Add or subtract time

Resulting time
Day change
Advertisement
Last updated: Source: Minute-based time arithmetic

How time duration is calculated

The duration calculator converts both times to total minutes since midnight and subtracts the start from the end. If the end time is earlier than the start time — for example a shift that runs from 10:00 PM to 6:00 AM — it assumes the end time falls on the following day and adds 24 hours (1,440 minutes) before subtracting, so overnight spans are always calculated correctly rather than showing a negative duration.

The add/subtract tool works the same way in reverse: it converts your starting time to total minutes, adds or subtracts the hours and minutes you enter, then wraps the result using modulo 24 hours so times correctly roll over midnight in both directions. Because JavaScript's remainder operator can return negative numbers when subtracting past midnight, the calculator applies a guard (adding 1,440 minutes before taking the modulo) to always produce a valid time of day.

Worked example: an overnight shift

A shift running from 10:00 PM to 6:15 AM:

  • Start: 10:00 PM = 22:00 = 1,320 minutes since midnight
  • End: 6:15 AM = 06:15 = 375 minutes since midnight — earlier than the start, so the calculator adds 1,440 minutes (24 hours): 375 + 1,440 = 1,815
  • Duration: 1,815 − 1,320 = 495 minutes = 8 hours 15 minutes
  • Decimal hours for payroll: 495 ÷ 60 = 8.25 hours

Converting between time formats

Time can be expressed in 12-hour format with AM/PM (e.g. 2:30 PM) or 24-hour format (e.g. 14:30), and this calculator displays results in a clean 12-hour format for readability. For payroll and timesheets, it's often useful to convert minutes into decimal hours: divide the minutes by 60, so 30 minutes becomes 0.5 hours and 45 minutes becomes 0.75 hours. A shift of 7 hours 15 minutes is therefore 7.25 decimal hours — the duration result above shows this conversion automatically.

Advertisement

Minutes to decimal hours, quick reference

MinutesDecimal hours
15 min0.25
30 min0.50
45 min0.75
1 hr 30 min (90 min)1.50
3 hr 45 min (225 min)3.75
7 hr 15 min (435 min)7.25

Payroll systems almost always want decimal hours, not hours-and-minutes — entering "7:15" instead of "7.25" into a timesheet is a common source of underpaid overtime.

What this calculator does not include

  • Time zones — both times are assumed to be in the same zone. For cross-timezone calculations, convert both to the same zone first.
  • Breaks/unpaid time — if a shift includes an unpaid lunch break, subtract that separately; the calculator only computes the raw span between two clock times.
  • Multi-day spans — this handles overnight (one midnight crossing) but not durations spanning several days; use our date calculator for spans measured in days.

Frequently asked questions

How do I convert minutes to decimal hours for payroll?

Divide the minutes by 60. For example, 30 minutes is 30/60 = 0.5 hours, so 2 hours 30 minutes becomes 2.5 hours. The duration result above includes a decimal hours figure for this purpose.

Does this handle times that cross midnight?

Yes. If the end time is earlier than the start time, the calculator assumes the end time falls on the next day and adds 24 hours before computing the duration.

What is the difference between 12-hour and 24-hour time?

12-hour time uses AM/PM with hours 1 through 12 (2:30 PM). 24-hour time runs from 00:00 to 23:59 without AM/PM, so 2:30 PM is written as 14:30.

How does adding or subtracting time handle going past midnight?

The calculator works in total minutes and wraps the result using modulo 24 hours, so times correctly roll over to the next or previous day instead of showing an invalid result.

Can I calculate time duration for a night shift?

Yes. Enter a start time like 10:00 PM and an end time like 6:00 AM in the duration section, and the calculator will detect the midnight crossing and return the correct total hours and minutes.

Why does payroll want decimal hours instead of hours and minutes?

Payroll systems multiply hours by an hourly rate, and 15 isn't a clean fraction of 60 the way 0.25 is of 1 — entering "7:15" as if it were 7.15 hours (rather than the correct 7.25) is a common payroll error. See the conversion table above.

Does this work across time zones?

No — both times entered are assumed to be in the same time zone. For a cross-timezone duration, convert both times to a single zone (like UTC) before entering them.

This calculator is provided for general reference. Always double-check critical time calculations for payroll, legal or medical purposes.

Advertisement