How the Calculation Works Internally
All arithmetic is performed on whole seconds. Times are converted to seconds from midnight, dates are converted to absolute day ordinals, and only the final display step divides or formats.
| Constant | Value in seconds |
|---|---|
| 1 minute | 60 |
| 1 hour | 3,600 |
| 1 day | 86,400 |
The start and end clock times become:
The gross interval combines the day gap with the two clock offsets:
Subtracting the break gives the net interval:
Because integers are exact, there is no cumulative floating-point error. Division happens only when producing the displayed metrics, which are shown to at most 4 decimal places with trailing zeros removed.
Two Modes: Clock Times and Dates & Times
Clock Times (default)
Enter a start time and an end time between 00:00:00 and 23:59:59, in HH:mm or HH:mm:ss form. The defaults are 09:00 and 17:30. An End day selector chooses between Same day and Next day; date fields are hidden in this mode, so is 0 or 1.
Dates & Times
Switch to this mode to enter a start date and an end date, both between 1900-01-01 and 2100-12-31, alongside the same time fields. The End day selector is hidden here, and the day gap is strictly:
The end timestamp must be at or after the start timestamp. The defaults are 2026-01-01 and 2026-01-02.
Calculating Hour Duration: Sexagesimal Time vs. Decimal Hours
Clock time is sexagesimal (base 60), while payroll, billing, and spreadsheets generally want base 10. The calculator reports both from the same :
The formatted breakdown never rolls over at 24 hours, so a 48-hour interval displays as 48h 0m 0s rather than "2 days". Total seconds is always an exact integer.
A common mistake is reading 7:30 as 7.30 hours. Thirty minutes is half an hour, so 7 hours 30 minutes is 7.5 decimal hours. Use this lookup for the minute part of any duration:
| Minutes | Decimal hours |
|---|---|
| 5 | 0.0833 |
| 6 | 0.1 |
| 10 | 0.1667 |
| 15 | 0.25 |
| 20 | 0.3333 |
| 30 | 0.5 |
| 45 | 0.75 |
| 50 | 0.8333 |
Values such as 5 and 10 minutes are repeating decimals, which is why results are capped at 4 places. The underlying seconds value remains exact, so rounding only ever affects what you read, not what is computed.
Overnight Shifts: Spanning Midnight Without Errors
Clock times alone carry no date, so a start of 22:00 and an end of 06:00 is ambiguous. The calculator resolves it with the End day selector:
- Same day: the end time must be greater than or equal to the start time. If it is earlier, the tool returns "End is before start. Choose Next day for an overnight interval." If the times are equal, the interval is 0 seconds.
- Next day: exactly 86,400 seconds are added. If start and end are identical, the interval is exactly 24 hours.
For 22:00 to 06:00 on the next day:
Forcing an explicit choice prevents the silent wrap-around that makes many spreadsheet formulas return negative or wrong values after midnight.
Elapsed Duration Between Two Dates and Leap Year Handling
For intervals longer than a day, dates are mapped to ordinals using proleptic Gregorian rules, meaning the current leap-year logic is applied to all years in range:
A year is a leap year if it is divisible by 4, except century years, which must also be divisible by 400. See the US Naval Observatory for background on the Gregorian calendar.
| Year | Divisible by 4 | Divisible by 100 | Divisible by 400 | Leap year |
|---|---|---|---|---|
| 1900 | Yes | Yes | No | No |
| 2000 | Yes | Yes | Yes | Yes |
| 2024 | Yes | No | n/a | Yes |
| 2100 | Yes | Yes | No | No |
Consider 2024-02-28 00:00 to 2024-03-01 00:00. The interval crosses 28 February, the leap day 29 February, and reaches 1 March, so :
That is 48 decimal hours and 2,880 minutes. In a non-leap year the same dates would span only 1 day. The tool also validates each date, so an impossible input such as 2023-02-29 is rejected instead of being silently adjusted.
Deducting Breaks: Net Work Intervals and Timesheet Math
The Total break field accepts whole minutes from 0 to 1,000,000, with a slider covering 0 to 240 minutes and a number input for larger values. The default is 30 minutes. The break is subtracted from the gross interval as a single lump sum:
If the break exceeds the gross interval, the tool reports "Total break cannot exceed the interval before breaks." Combine all meal and rest periods into one number before entering them.
| Shift | Mode and End day | Break | Gross | Net | Decimal hours |
|---|---|---|---|---|---|
| 09:00 to 17:30 | Clock, Same day | 30 min | 8h 30m | 8h 0m | 8 |
| 22:00 to 06:00 | Clock, Next day | 30 min | 8h 0m | 7h 30m | 7.5 |
| 08:00 to 16:00 | Clock, Same day | 60 min | 8h 0m | 7h 0m | 7 |
| 07:00 to 19:00 | Clock, Same day | 60 min | 12h 0m | 11h 0m | 11 |
| 00:00 to 00:00 | Clock, Next day | 0 min | 24h 0m | 24h 0m | 24 |
One-Click Presets
Three presets load exact scenarios so you can verify the logic:
| Preset | Setup | Gross | Break | Net | Decimal hours | Total minutes |
|---|---|---|---|---|---|---|
| Day with lunch | Clock, 09:00 to 17:30, Same day, 30 min | 8h 30m 0s (30,600 s) | 0h 30m 0s (1,800 s) | 8h 0m 0s (28,800 s) | 8 | 480 |
| Overnight | Clock, 22:00 to 06:00, Next day, 30 min | 8h 0m 0s (28,800 s) | 0h 30m 0s (1,800 s) | 7h 30m 0s (27,000 s) | 7.5 | 450 |
| Leap-day interval | Dates & times, 2024-02-28 00:00 to 2024-03-01 00:00, 0 min | 48h 0m 0s (172,800 s) | 0h 0m 0s | 48h 0m 0s (172,800 s) | 48 | 2880 |
Visual Bar, Clipboard Export, and Print
A reactive SVG bar shows net elapsed time in orange against the deducted break in slate. The break is drawn at the tail end purely for proportional comparison; its position is illustrative and not chronological. The graphic supports zoom, pan, and viewport reset.
The clipboard export produces a plain-text summary with the timestamps, gross, break, and net values, decimal hours, total minutes and seconds, the wall-clock assumptions, and the canonical URL. The print and PDF action expands every collapsed section before the browser's print dialog opens.
Scope Boundaries: What This Tool Does Not Model
Knowing the limits matters as much as the formulas.
- Wall-clock only. Every calendar day is exactly 86,400 seconds.
- No time zones or daylight saving. Browser
datetime-localinputs, documented on MDN Web Docs, carry no offset. A 23-hour spring-forward day or a 25-hour fall-back day is not detected, so an interval crossing a transition can be off by one hour compared with real elapsed time. - No leap seconds. Time units follow the SI definitions in NIST Special Publication 811, and no leap seconds are inserted.
- Elapsed, not inclusive. The result is . January 1 to January 2 at the same time is 24 hours, not "2 days".
- No months-and-years breakdown. Month lengths vary from 28 to 31 days, so "X months, Y days" is ambiguous and deliberately omitted.
- No payroll compliance. Daily or weekly overtime thresholds, spread-of-hours rules, and tax deductions are outside scope. Treat the net hours as an input to a payroll system, not as a compliance determination.
Frequently Asked Questions
How do I convert 7 hours 45 minutes to decimal hours?
Convert the minutes to hours and add: . Enter the interval or its endpoints and the decimal hours field reports the same value.
Why does my result show more than 24 hours?
The breakdown is not capped at a day. A 48-hour interval is reported as 48h 0m 0s, which makes it easy to total multi-day durations directly.
Can I calculate the time between two dates without clock times?
Yes. Switch to Dates & times, set both times to 00:00, and the result is the day gap multiplied by 24 hours.
Read the formula definitions, supported input ranges, and limitations before using this estimate.