All tools

ISO 8601 Duration Parser / Formatter

Time

Parse an ISO 8601 duration like P3DT4H30M into its components and total seconds, or format a number of seconds back into a canonical duration string.

ISO 8601 durations show up in places timestamps do not: YouTube video lengths in the API (contentDetails.duration), retry and timeout configs, database interval columns, and JSON scheduling payloads, all written as strings like PT1H30M or P3DT4H. This tool goes both ways. Parse mode breaks a duration string into its years, months, weeks, days, hours, minutes, and seconds and gives you a total in seconds plus a plain-English readout. Format mode takes a number of seconds and builds the canonical duration back out. Years and months have no fixed length, so when a parsed value contains them the total-seconds figure is flagged approximate and uses 365-day years and 30-day months, and formatting deliberately emits only days through seconds to stay unambiguous. Everything runs locally with no dependencies.

iso8601durationtimeparseformat

How to use ISO 8601 Duration Parser / Formatter

  • 1.Choose Parse to turn an ISO 8601 string into components and seconds, or Format to turn seconds into a duration string.
  • 2.Type or paste the value: a duration like P3DT4H30M, or a number of seconds like 90061.
  • 3.Read the breakdown, the total in seconds, and the human-readable form; watch for the approximate flag when years or months are involved.

Frequently asked questions

What ISO 8601 duration forms are supported?
The full PnYnMnWnDTnHnMnS grammar, including week durations (P2W) and fractional seconds (PT1.5S). A bare P with no components is rejected as invalid.
Why is the total in seconds marked approximate for years and months?
Years and months vary in length (leap years, 28 to 31 day months), so there is no exact second count. When either is present the tool uses 1 year = 365 days and 1 month = 30 days and flags the result as approximate.
Why does formatting never output years or months?
For the same ambiguity reason. Formatting a number of seconds emits a canonical string using only days, hours, minutes, and seconds, so the round trip back to seconds is exact.
Does it handle negative durations?
No. ISO 8601 durations are non-negative here; formatting rejects a negative number of seconds.

Use via API, SDK, or MCP

cURL# Free: 1,000 req/day · Pro: 10,000 req/day
curl -X POST https://api.utilix.tech/v1/tools/iso8601-duration \
  -H "Authorization: Bearer utx_live_..." \
  -H "Content-Type: application/json" \
  -d '{"mode":"parse","input":"P3DT4H30M","seconds":90061}'

Get an API key from your dashboard · Full API docs →