DevKits

ISO 8601 Duration Parser — Convert P3Y6M4DT12H30M5S to Human Time

Parse ISO 8601 duration strings (P3Y6M4DT12H30M5S, PT1H30M, P2W) into human-readable form, or convert total seconds into a canonical ISO 8601 duration. 100% local — used by REST APIs, video metadata, and scheduling systems.

Last updated:

Human readable

3 years, 6 months, 4 days, 12 hours, 30 minutes, 5 seconds

Approx. total seconds
110,843,501
Using 365.25 d/year, 30.44 d/month
Approx. total minutes
1,847,391.68
Approx. total hours
30,789.86

Components

Years
3
Months
6
Weeks
0
Days
4
Hours
12
Minutes
30
Seconds
5

Paste an ISO 8601 duration like P3Y6M4DT12H30M5S to see it broken into components and rendered in plain English, plus approximate totals in seconds / minutes / hours. Or switch to the 'Seconds → ISO' mode to canonicalize a raw duration.

What is ISO 8601 Duration?

ISO 8601 defines a compact machine-readable format for durations: `PnYnMnDTnHnMnS`, with each letter marking one unit and the `T` separating date from time components. `PT1H30M` is 1 hour 30 minutes. `P2W` is two weeks. This is the format YouTube's Data API returns for video length, Java's Duration.parse() accepts, Kubernetes uses in some manifests, and PostgreSQL and Java both understand as intervals. Working with it manually — especially at API boundaries — is tedious. This tool parses ISO 8601 durations into their components, humanizes them, and also runs the reverse conversion (from a raw total in seconds).

How to work with ISO 8601 durations

  1. 1Choose direction: 'Parse ISO → Human' or 'Seconds → ISO'.
  2. 2In parse mode, paste an ISO 8601 duration string and read the components, human-readable form, and approximate totals in seconds / minutes / hours.
  3. 3In seconds mode, enter a total in seconds and copy the canonicalized ISO 8601 duration.
  4. 4Click any sample chip (`P1Y`, `PT1H30M`, `P2W`, …) to see how the format handles different unit combinations.

Tips & Best Practices

  • Years and months in ISO 8601 are ambiguous durations — 'P1M' can mean 28, 29, 30, or 31 days depending on the anchor date. For precise math, apply the duration to a specific start date instead of converting to seconds.
  • PnW cannot be combined with other components per the strict standard. Most permissive parsers (including this tool) still accept `P2W3D`, but the result may not round-trip through every system.
  • The T is required whenever a time component (H/M/S) is present. `P1H` is invalid; `PT1H` is correct.
  • Java's Duration.parse() only accepts the day/hour/minute/second subset — no years, months, or weeks. If interop matters, avoid the Y and M fields when producing durations for Java consumers.

Frequently Asked Questions

What is an ISO 8601 duration?

A compact machine-readable duration format from the ISO 8601 standard, of the form PnYnMnDTnHnMnS — e.g. P3Y6M4DT12H30M5S is 3 years, 6 months, 4 days, 12 hours, 30 minutes, 5 seconds. The T separates the date portion from the time portion. Weeks (PnW) is an alternative that cannot be combined with the other components.

Where are ISO 8601 durations used?

YouTube API returns video length as PT4M23S. Kubernetes and Java's Duration.parse() accept them. Backup / retention policies in AWS S3 lifecycle rules, PostgreSQL interval, and many scheduling libraries all accept this format.

Are years and months exact?

No. Because years and months have variable length, the 'total seconds' number uses averages (365.25 days per year, 30.44 days per month). For precise date arithmetic, apply the duration to a specific starting date instead of converting to seconds.

Can it handle decimals like PT1.5S?

Yes. Fractional values are accepted on any field, and both '.' and ',' are recognized as decimal separators per ISO 8601. Note that most consumers only accept fractions on the smallest specified unit.

Is the input uploaded anywhere?

No. Parsing and formatting run entirely in your browser.

Related Tools