HomeEveryday 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

ParameterTypeUnitRequiredDescription
start_timestringyesStart clock time in 24-hour HH:MM format.
end_timestringyesEnd clock time in 24-hour HH:MM format. An end time earlier than the start time is taken as the next day.
break_minutesintegermindefault 0Unpaid or excluded minutes to subtract from the interval. Range: ≥ 0, ≤ 1440

Outputs

OutputTypeUnitDescription
total_minutesintegerminElapsed minutes after subtracting the break.
hoursintegerhWhole hours of the duration.
minutesintegerminMinutes beyond the whole hours.
decimal_hoursnumberhtotal_minutes / 60, e.g. for timesheets.
duration_textstringDuration as 'h h m min'.
gross_minutesintegerminMinutes from start_time to end_time before subtracting the break.
crosses_midnightbooleantrue 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

Sources

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