Hours Between Calculator: How to Count Time
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 calculator works out the exact number of hours (and minutes) between two dates and times. Enter a start date/time and an end date/time, and you get the duration in hours, plus the total minutes and the time in decimal hours. The result is useful for shift planning, travel time, project tracking, or any situation where you need a precise elapsed time.
Formula
The calculator treats both dates and times as timestamps—the number of milliseconds since January 1, 1970, 00:00:00 UTC. The difference is simply:
Hours = (End Timestamp − Start Timestamp) / 3,600,000
- End Timestamp – the end date/time converted to milliseconds (ms)
- Start Timestamp – the start date/time converted to milliseconds (ms)
- 3,600,000 – the number of milliseconds in one hour (60 min × 60 s × 1000 ms)
The result is a decimal number, e.g., 8.5 hours means 8 hours and 30 minutes. The calculator also shows total minutes (multiply the difference by 1/60,000) and full days (divide by 86,400,000 and round down).
Worked Example
Using the default values: start = January 1, 2025, 09:00; end = January 1, 2025, 17:30.
- Convert both to timestamps (in milliseconds, but the difference is what matters).
- Difference = end − start = 8.5 hours × 3,600,000 ms = 30,600,000 ms.
- Hours = 30,600,000 / 3,600,000 = 8.50 hours.
- Total minutes = 30,600,000 / 60,000 = 510 minutes.
- Full days = floor(30,600,000 / 86,400,000) = 0 days.
The calculator displays 8.50 hours, which matches. Note that 0.50 hours is 30 minutes, so 8.50 hours = 8 hours 30 minutes.
Why Use a Dedicated Hours Calculator?
Counting hours “by hand� is easy when the start and end are on the same day and the minutes align, but it gets tricky when:
- The time spans midnight (e.g., 23:00 to 02:00).
- The dates cross multiple days or months.
- You need to account for AM/PM correctly.
- You want a decimal result for payroll or billing (e.g., 7.75 hours instead of 7:45).
A calculator removes the risk of arithmetic errors and gives you a consistent, repeatable result. It also handles time zones if you enter both times in the same zone—see the note below.
How to Read the Result
The primary output is the total hours as a decimal. To convert the fractional part to minutes, multiply by 60:
- 0.25 hours = 15 minutes
- 0.50 hours = 30 minutes
- 0.75 hours = 45 minutes
For example, 8.75 hours is 8 hours and 45 minutes. The “Total minutes� output gives you the same duration in minutes only (525 minutes for 8.75 hours), which is handy for comparing with minute-based limits. The “Full days� output tells you how many complete 24-hour periods are inside the duration—useful for multi-day shifts or shipping times.
Common Mistakes and Pitfalls
- Mixing AM and PM – 9:00 AM to 5:00 PM is 8 hours, but 9:00 PM to 5:00 PM (next day) is 20 hours. Always check the AM/PM indicator.
- Ignoring the date change – If you only enter times (no dates), the calculator assumes the same day. If your end time is earlier than the start time, the result will be negative. Enter full dates to avoid this.
- Time zone differences – This calculator assumes both times are in the same time zone. If you’re calculating across time zones, convert both to UTC first, or add the offset manually.
- Rounding too early – If you round the hours to 2 decimals, you lose precision. For payroll, keep at least 4 decimals or use exact minutes.
- Daylight saving time – The calculator uses actual elapsed time, not “wall clock� time. If your region springs forward or falls back during the interval, the result may differ from what a calendar suggests. For example, a shift from 1:00 AM to 3:00 AM on a spring-forward day is actually 1 hour, not 2.
Practical Uses for an Hours Calculator
- Work shifts – Calculate the length of a shift, including breaks if you subtract them.
- Travel time – Get the total hours of a flight or road trip, even if it crosses time zones (use UTC).
- Project deadlines – See how many hours remain until a due date.
- Time tracking – Convert start/end times into decimal hours for invoicing or timesheets.
- Events – Measure the duration of a conference, festival, or online sale.
In all cases, the formula is the same: subtract the start from the end, then convert to hours.
Alternatives: Manual Calculation and Spreadsheets
If you don’t have this calculator handy, you can do it manually:
- Convert both times to a 24-hour format (e.g., 5:00 PM = 17:00).
- Convert each to minutes since midnight: hours × 60 + minutes.
- Subtract the start minutes from the end minutes. If the end is earlier, add 24 hours (1440 minutes) to the end.
- Divide the difference by 60 to get hours.
For example, 9:00 AM to 5:30 PM: 9:00 = 540 min, 17:30 = 1050 min. Difference = 510 min = 8.5 hours. This works for same-day calculations. For multi-day, add 1440 minutes per full day.
Spreadsheet programs (Excel, Google Sheets) have built-in functions: =B2-A2 formatted as [h]:mm will show total hours. But the calculator here is faster for a one-off check and doesn’t require formatting tricks.
Frequently Asked Questions
How do I calculate hours between two times on different days?
Enter the full date and time for both the start and end. The calculator automatically handles the day difference. If you only have times, add the date manually—for example, if a shift starts at 10 PM and ends at 6 AM the next day, enter start as “2025-01-01 22:00� and end as “2025-01-02 06:00�. The result will be 8 hours.
What does 8.50 hours mean?
It means 8 hours and 30 minutes. The decimal part (0.50) is a fraction of an hour, not minutes. To convert, multiply the decimal by 60: 0.50 × 60 = 30 minutes. So 8.50 hours = 8:30.
Can I use this for payroll or billing?
Yes, the decimal hours output is directly usable for payroll if your company uses decimal hours (e.g., 8.50). However, check your local labor laws and company policy—some require rounding to the nearest quarter-hour. The calculator gives exact elapsed time, not rounded.
Does the calculator account for time zones?
No, it assumes both inputs are in the same time zone. To calculate across time zones, convert both times to UTC (or the same reference zone) before entering. For example, if you’re in New York (UTC-5) and the other person is in London (UTC+0), subtract 5 hours from the London time (or add to New York) to align them.
Why is my result negative?
A negative result means the end time is earlier than the start time. This usually happens when you enter times without dates and the end time is on the next day. Add the correct date to the end time, or swap the two inputs.
How do I subtract breaks from the total hours?
Calculate the total hours between start and end, then separately calculate the break duration (e.g., 30 minutes = 0.5 hours), and subtract. For example, if you work from 9:00 to 17:30 (8.5 hours) and take a 30-minute lunch, your paid hours are 8.0.
Related
Formula used
in start | Start date/time | - | 2025-01-01 09:00 | 0 in end | End date/time | - | 2025-01-01 17:30 | 0 out hours | Hours between | h | (end - start) / 3600000 | 2 out minutes | Total minutes | min | (end - start) / 60000 | 0 out days | Full days | d | floor((end - start) / 86400000) | 0
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.