ForHosting KIT · Home, food & hobbies

Clock duration calculator

From 09:30 to 14:45 is 5 hours 15 minutes, and a night shift from 22:15 to 06:40 wraps past midnight correctly. Enter two 24-hour clock times, with no date needed, and get the elapsed hours and minutes. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Start time
09:30
End time
14:45
You get
Start
09:30
End
14:45
Hours
5
Minutes
15

How long is it from 09:30 to 17:45? How long is a night shift that starts at 22:15 and ends at 06:40? A clock duration calculator answers those everyday questions without a calendar date: you give two 24-hour clock times and it returns the elapsed hours and minutes, wrapping past midnight when the end is earlier than the start. Invalid times such as 25:00 or 9:30 AM are rejected instead of being silently reinterpreted. There is no network call, no system clock, and no randomness — only minutes from midnight and a single optional plus-twenty-four-hour wrap.

How two clock times become hours and minutes

A twenty-four-hour clock time is a position on a circular civil day, not a duration and not a calendar date. Nine thirty in the morning is five hundred seventy minutes after midnight; fourteen forty-five is eight hundred eighty-five minutes after midnight. Subtracting those minute-from-midnight counts gives the elapsed interval when both readings sit on the same calendar day: eight hundred eighty-five minus five hundred seventy is three hundred fifteen minutes, which splits as five hours and fifteen minutes.

When the end is earlier than the start — a night shift from twenty-two fifteen to six forty, a parking stay that crosses midnight, a sleep window from twenty-three ten to six fifty — a naive subtraction goes negative. The clock-duration rule then adds one thousand four hundred forty minutes, the length of one civil day, so the interval wraps once past midnight and stays in the closed range from zero hours zero minutes through twenty-three hours fifty-nine minutes.

Equal start and end yield zero elapsed time, not a full day, because the two readings name the same instant on the face.

Where a clock duration calculator earns its keep

People reach for a clock duration calculator whenever two wall-clock readings must become a length without inventing a calendar date. Parking and garage systems quote elapsed stay from entry to exit, including an overnight wrap when a car leaves after midnight. Parents and coaches time a practice that begins at sixteen hundred and ends at seventeen forty-five.

Nurses, dispatchers, and hotel night desks compute an interval that starts late and ends early the next morning. Students learning elapsed time check that 09:30 to 14:45 is five hours fifteen minutes instead of a borrow error on paper. Because the tool refuses twelve-hour AM/PM strings and illegal hours, it also doubles as a twenty-four-hour format validator for intake forms that must not accept 25:00.

Pair this page with a date-difference or countdown tool if you also need whole days between calendar dates, or with an add-time calculator if you need to sum two durations rather than subtract two clock faces.

Night-shift and overnight work hours

Turn a 22:15 start and a 06:40 end into eight hours twenty-five minutes for a timesheet that needs clock-face elapsed time, not decimal hours.

Parking and appointment elapsed stay

Compute how long a car, a court slot, or a clinic visit lasted from the entry clock time to the exit clock time, including a wrap past midnight.

Classroom elapsed-time checks

Let students verify that 09:30 to 14:45 is five hours fifteen minutes, and that 25:00 is rejected as an illegal 24-hour clock time.

What happens if the end time is earlier than the start time?

The interval is treated as wrapping once past midnight. From 22:15 to 06:40 the result is 8 hours 25 minutes and overnight is true. Equal times yield zero, not a full day.

Which clock formats are accepted?

Only 24-hour H:MM or HH:MM, with hour 0–23 and minute 00–59. Leading zeros on the hour are optional. Seconds, ISO datetimes, and 12-hour AM/PM are rejected.

What if the start and end times are the same?

The result is zero, not a full day. Two equal readings name the same moment on the clock face, so the calculator does not assume that 24 hours went by in between.

Can it measure a stretch longer than 24 hours?

No. It wraps past midnight only once, so results run from zero up to 23 hours 59 minutes. For several days, use a tool that counts between calendar dates.

Does it also give the total in minutes?

Yes. Besides hours and minutes you get the exact minute count, which is handy for timesheets and parking stays: 09:30 to 14:45 is 315 minutes.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/life/clock-duration

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/life/clock-duration \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"start_time":"09:30","end_time":"14:45"}'
{
  "start_time": "09:30",
  "end_time": "14:45"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "life.clock_duration",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

How two clock times become hours and minutes

The algorithm never consults the system clock, never calls a network service, and never uses randomness, so the same pair of clock strings always produces the same hours, minutes, total_minutes, and overnight flag.

Input contract, twenty-four-hour format, and errors

Each must be a valid twenty-four-hour clock time in H:MM or HH:MM form, with the hour an integer from zero through twenty-three and the minute a two-digit integer from zero through fifty-nine. Leading zeros on the hour are optional, so nine-oh-five and 09:05 name the same instant. A missing field, an empty string after trim, or a non-string value also fails, because this contract is a clock-face format, not a duration adder and not a free-text parser. Invalid input is not billed. The request body carries two required strings: start_time and end_time. Twelve-hour strings such as 9:30 AM, ISO datetimes that include a calendar date, times that include seconds such as 14:30:00, and out-of-range values such as 24:00, 25:00, or 12:60 all fail with invalid_input and name the offending field. Aliases start, from, and begin are accepted for start_time; aliases end, to, until, and stop are accepted for end_time so forms and scripts can use the name they already have. On success the response echoes both times normalized to two-digit HH:MM, the elapsed hours and minutes as integers, total_minutes as the exact integer minute count, overnight as a boolean that is true only when the end was earlier than the start, a pretty string such as 5h 15m, and a short formula you can print next to the answer. Successful API calls use the published $0.002 base price.

Where a clock duration calculator earns its keep

Shift supervisors convert a start_time and an end_time into hours and minutes for a timesheet that refuses decimal hours. That keeps latency at a handful of arithmetic operations and keeps the cost model honest at $0.002 per successful API request, while failed validation never consumes prepaid balance.

How do I calculate elapsed time between two clock times?

Send start_time and end_time as 24-hour HH:MM strings. The API converts each to minutes from midnight, subtracts, adds 1440 minutes if the end is earlier, and returns hours plus minutes.

Why is 9:30 AM or 25:00 rejected?

This contract is a 24-hour clock face. Twelve-hour meridians and hours outside 0–23 are not valid 24-hour format, so they fail with invalid_input and are not billed.

What does the clock duration calculator cost?

The browser tool is free. API requests use prepaid balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →