ForHosting KIT · Developer Utilities

Subtract two HMS durations

Subtract one hours-minutes-seconds duration from another without converting the values by hand.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Enter two non-negative durations in HH:MM:SS form, and the calculator subtracts the second from the first, borrows across seconds and minutes when necessary, and returns an exact signed result. Hours are not restricted to a 24-hour clock, so the tool works for elapsed project time, media runtimes, training totals, machine cycles, and other long durations. The calculation depends only on the two values you provide.

Enter elapsed durations, not times of day

Provide the duration you want to subtract from as the first value and the duration being removed as the second value. Each entry uses HH:MM:SS, with two digits for minutes and seconds. Hours may use from one through six digits, which means 125:30:00 is valid even though 125 is not a clock hour. Minutes and seconds must remain between 00 and 59 because the calculator expects normalized input. Use 00 for an empty unit, such as 7:00:09 for seven hours and nine seconds. Inputs are non-negative; the sign belongs to the computed difference, not to either source duration. This distinction avoids ambiguous expressions involving two negative intervals. The calculator preserves the mathematical order exactly: first duration minus second duration. If both values are equal, the output is 00:00:00 with a zero sign. Whitespace around an entry is ignored, but words, decimal seconds, date fragments, and AM or PM suffixes are rejected so every accepted value has one deterministic meaning.

Understand borrowing and a negative result

HMS subtraction follows the same borrowing method used on paper. If the available seconds are smaller than the seconds being subtracted, one minute becomes sixty additional seconds. After the seconds column is resolved, if the available minutes are smaller than the minutes being subtracted, one hour becomes sixty additional minutes. The response reports whether either borrow happened, making the result useful for teaching, auditing, or displaying an explanation. When the second duration is longer than the first, the calculator compares their complete lengths, subtracts the smaller magnitude from the larger magnitude with the same borrow rules, and prefixes the normalized difference with a minus sign. It never produces awkward components such as negative minutes or 75 seconds. For example, a negative difference is represented as -02:04:09 rather than mixing a negative hour with positive or negative lower units. The numeric sign field is -1, 0, or 1, and total_seconds retains the signed difference for software that needs arithmetic rather than formatted text.

Use the normalized output reliably

The result includes the normalized HMS text, signed total seconds, sign, and separate absolute hours, minutes, and seconds components. That combination supports both human display and downstream calculations without requiring a caller to parse explanatory prose. Because these values describe durations, hours do not wrap at 24; a result of 49:10:00 means forty-nine elapsed hours and ten minutes. The computation uses bounded integer arithmetic only. It does not consult the current date, a time zone, daylight-saving rules, locale settings, a network service, or a language model, so identical inputs always produce identical output. This makes it suitable for build scripts, timesheet checks, test fixtures, media workflows, and repeatable reports. Validate the sign before treating the component fields as a direction: the component magnitudes are always non-negative, while the sign and formatted result state whether the difference is earlier or later in arithmetic terms. Browser use is free, and an automated API request uses the displayed base price of $0.002.

Compare media runtimes

Subtract an edited runtime from the original and see the exact signed amount removed or added.

Reconcile tracked work

Find the difference between two accumulated work durations even when either total exceeds 24 hours.

Check event timing

Compare planned and measured elapsed durations while preserving seconds and explicit borrowing details.

What does the API request cost?

Each API request costs $0.002. The browser calculator is free to use.

Can the result be negative?

Yes. If the second duration is longer, the normalized result begins with a minus sign and the sign field is -1.

Can hours be greater than 23?

Yes. These are elapsed durations, not wall-clock times, so hours may range from 0 through 999999.

Why must minutes and seconds be below 60?

Inputs must already use normalized HMS notation. Borrowing is applied during subtraction, and output minutes and seconds remain normalized.

Does this account for dates or daylight-saving time?

No. It subtracts two abstract durations only and never uses dates, zones, daylight-saving transitions, or the current time.

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/date/hms-subtract

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/date/hms-subtract \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"first_duration":"12:05:10","second_duration":"03:47:55"}'
{
  "first_duration": "12:05:10",
  "second_duration": "03:47:55"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "date.hms_subtract",
  "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.

max_hours999999
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.

Read the full KIT documentation →