Home › Everyday Life › Time Duration Calculator
Time Duration Calculator
Computes the elapsed time between a start and an end clock time (24-hour HH:MM), optionally minus a break, handling intervals that cross midnight, and reports it as hours and minutes and as decimal hours.
When to use
You need the length of a shift, meeting, trip or any interval given two clock times on the same or consecutive days.
Do not use when: The interval spans more than 24 hours or several days (use date-difference), or you need weekly hours and pay (use work-hours).
Formula
gross_minutes = end − start (+ 1440 if end < start); total_minutes = gross_minutes − break_minutes; decimal_hours = total_minutes / 60
Identical start and end times give 0 minutes, not 24 hours. Daylight-saving transitions are ignored.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
start_time | string | yes | Start clock time in 24-hour HH:MM format. | |
end_time | string | yes | End clock time in 24-hour HH:MM format. An end time earlier than the start time is taken as the next day. | |
break_minutes | integer | min | default 0 | Unpaid or excluded minutes to subtract from the interval. Range: ≥ 0, ≤ 1440 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
total_minutes | integer | min | Elapsed minutes after subtracting the break. |
hours | integer | h | Whole hours of the duration. |
minutes | integer | min | Minutes beyond the whole hours. |
decimal_hours | number | h | total_minutes / 60, e.g. for timesheets. |
duration_text | string | Duration as 'h h m min'. | |
gross_minutes | integer | min | Minutes from start_time to end_time before subtracting the break. |
crosses_midnight | boolean | true when end_time is earlier than start_time and was taken as the next day. |
Example
09:30 to 17:45 with a 30-minute break: {"start_time":"09:30","end_time":"17:45","break_minutes":30} → {"total_minutes":465,"hours":7,"minutes":45,"decimal_hours":7.75,"duration_text":"7 h 45 min","gross_minutes":495,"crosses_midnight":false}
Night shift 22:00 to 06:30: {"start_time":"22:00","end_time":"06:30"} → {"total_minutes":510,"hours":8,"minutes":30,"decimal_hours":8.5,"duration_text":"8 h 30 min","crosses_midnight":true}
GET https://tttkmbb.com/api/v1/calculate/time-duration?start_time=09%3A30&end_time=17%3A45&break_minutes=30
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/time-duration(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/time-duration · Markdown: https://tttkmbb.com/everyday/time-duration.md · JSON definition: https://tttkmbb.com/everyday/time-duration.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="time-duration" - OpenAPI operationId:
calculate_time_duration - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- ISO 8601 – Date and time format (Wikipedia) (reference)
FAQ
How do I enter 12-hour times?
Convert to 24-hour clock first: 5:45 PM is 17:45, 12:30 AM is 00:30.
What if the break is longer than the interval?
The calculator returns a CALCULATION_ERROR; check the times or the break length.
Related calculators
- Work Hours Calculator — Weekly and monthly hours and pay from the same shift times.
- Date Difference Calculator — Intervals spanning several days.