ForHosting KIT · Dates & time

Total duration of time intervals

Paste a list of time intervals and get the real time they cover: 10:00 to 12:00 and 11:00 to 13:00 UTC cover 3 hours, not the 5 a plain sum gives. Overlapping and touching intervals are merged first. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon

Operations teams, payroll scripts, and SLA tools often hold many explicit time intervals that overlap: on-call shifts, equipment bookings, downtime windows, or billable sessions. Summing each interval naively double-counts the shared minutes. This total duration of time intervals calculator accepts a list of ISO-8601 start and end pairs, normalizes every bound to absolute UTC with pure Gregorian arithmetic, merges intervals that overlap or touch, and returns the single covered span length in milliseconds, seconds, and hours plus a day–hour–minute–second breakdown.

What covered duration means after merging overlaps

Covered duration is the measure of the union of your intervals on the absolute time line, not the sum of each raw length. If Alice books ten o’clock to twelve and Bob books eleven to thirteen on the same UTC day, the naive sum is five hours while the covered span is only three hours from ten through thirteen. Touching intervals such as ending at twelve and starting at twelve merge into one continuous block, which is the correct continuous-time model for coverage, occupancy, and SLA uptime.

Zero-length and inverted intervals are rejected because they do not define a positive open span.

What to enter and what the result shows

Each object must include string fields start and end in ISO-8601 form: a four-digit year, month, and day, optionally followed by a time of day with hours, minutes, seconds, and an optional fractional second part. A trailing Z means UTC; a numeric offset such as plus zero two colon zero zero or minus zero five colon zero zero shifts the local fields into absolute UTC before merging. Date-only values are treated as midnight UTC so day-level windows work without inventing a clock.

Optional null fields are never emitted. Failed validation does not consume balance.

Where a covered-time total really helps

Workforce and on-call platforms merge shift fragments so payroll and fatigue rules charge continuous coverage rather than overlapping double hours. Facilities and lab booking systems compute occupancy of a room or instrument when reservations stack, feeding utilization dashboards without custom SQL window functions on every report. Site reliability and status pages turn many partial outage intervals into one covered downtime length for monthly SLA math.

Project time trackers consolidate duplicate session logs from mobile and desktop clients that recorded the same work twice with slightly different clocks. Pair this tool with pairwise interval intersection when you need the overlap of exactly two ranges, or with humanize-duration helpers when you only need pretty text from a single second count.

On-call and shift coverage totals

Merge overlapping duty windows for a team so payroll and fatigue checks use covered hours instead of double-counting concurrent shifts.

Room and resource occupancy

Sum the union of bookings for a lab bench or meeting room when reservations overlap, for utilization reports without raw SQL.

SLA downtime from partial outages

Collapse many incident intervals into one covered outage duration for monthly availability math and status-page exports.

Are overlapping minutes counted twice?

No. Intervals are sorted and merged before summing, so shared coverage contributes only once to the total covered duration.

What happens when two intervals only touch at one end?

They merge into one continuous block. A booking that ends at 12:00 and another that starts at 12:00 count as a single stretch, so the contact point never adds or removes time.

How many intervals can I enter?

From one to 200 in a single list. Each needs a start and an end, and the start must come strictly before the end; zero-length or reversed intervals are rejected.

Can I enter dates without a time?

Yes. A date on its own is read as midnight UTC, which makes day-level windows easy. Times can carry Z for UTC or a numeric offset, and everything is converted to UTC before merging.

How can I see which intervals were merged?

The result lists each merged segment with its own start, end and duration, and shows how many intervals you entered next to how many remain after merging, so you can audit the total.

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/intervals-total-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/date/intervals-total-duration \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"intervals":[{"start":"2020-01-01T10:00:00Z","end":"2020-01-01T12:00:00Z"},{"start":"2020-01-01T11:00:00Z","end":"2020-01-01T13:00:00Z"}]}'
{
  "intervals": [
    {
      "start": "2020-01-01T10:00:00Z",
      "end": "2020-01-01T12:00:00Z"
    },
    {
      "start": "2020-01-01T11:00:00Z",
      "end": "2020-01-01T13:00:00Z"
    }
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "date.intervals_total_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.

Adjacent bookings that meet at an endpoint become one continuous segment so a zero-length contact point never inflates the total. Invalid ISO shapes, inverted ranges, and empty lists fail with invalid_input and are not charged.

What covered duration means after merging overlaps

This endpoint implements the classic sort-and-merge algorithm: every start and end is converted to UTC epoch milliseconds, the list is ordered by start time, and each next interval either extends the current open segment when it starts at or before that segment’s end, or opens a new segment when there is a positive gap. The response reports input_count versus merged_count so you can see how much consolidation happened, and lists each merged segment with its own start, end, and duration for audit trails. Use total_duration_ms when you need an integer primary measure; use total_duration_hours when dashboards expect a fractional hour figure rounded to a stable twelve decimal places; use days, hours, minutes, and seconds together when you render a human-readable line without redoing the division.

Input contract, ISO bounds, and response shape

POST a JSON body with a required intervals array of one to two hundred objects. After normalization, start must be strictly before end; equal or reversed bounds fail with invalid_input naming the interval index. On success the body includes input_count, merged_count, total_duration_ms, total_duration_seconds, total_duration_hours, the non-negative breakdown fields days, hours, minutes, seconds, and milliseconds, a compact formatted string such as zero d three h zero m zero s, the ordered merged_intervals array with ISO UTC endpoints, and method set to intervals_total_duration. Example: two overlapping hours-long windows from ten to twelve and eleven to thirteen UTC merge to one three-hour segment and total_duration_ms of ten million eight hundred thousand. Keep the list under the published maximum so edge Workers stay within memory budgets while still covering realistic batch jobs.

Where a total duration of time intervals API earns its keep

Pin merged_intervals and total_duration_ms in tests so refactors cannot silently change merge touch semantics.

How do I compute the total duration of overlapping time intervals?

Send JSON with intervals as an array of {start, end} ISO-8601 datetimes. The API merges overlaps in UTC and returns total_duration_ms, total_duration_seconds, total_duration_hours, and merged_intervals.

What if two intervals only touch at an endpoint?

They merge into one continuous segment. Touching bounds do not create a gap and do not add extra duration beyond the combined span.

What input errors are rejected?

Empty or missing intervals, non-objects, invalid ISO strings, impossible calendar days, and start not strictly before end fail with invalid_input and are not billed.

What does the total duration of time intervals tool cost?

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

Read the full KIT documentation →