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
Components
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
- 1Choose direction: 'Parse ISO → Human' or 'Seconds → ISO'.
- 2In parse mode, paste an ISO 8601 duration string and read the components, human-readable form, and approximate totals in seconds / minutes / hours.
- 3In seconds mode, enter a total in seconds and copy the canonicalized ISO 8601 duration.
- 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
Timestamp Converter
Convert Unix timestamps to human-readable dates and vice versa. Supports seconds, milliseconds, ISO 8601, and timezone selection.
Timezone Converter
Convert any date and time between IANA time zones — UTC to EST, PST to Tokyo, Sydney to London. Correct DST handling, compare multiple zones side-by-side. 100% local.
Working Days
Count business (working) days between two dates. Customize your workweek (M-F, M-Sat, custom) and paste a list of holidays to exclude them. Also shows total days, weekend days, and calendar span. 100% local.
Age Calculator
Calculate your exact age in years, months, and days from a date of birth. Shows total weeks, days, hours, and minutes lived, plus the countdown to your next birthday. 100% local — nothing uploaded.
Date Diff
Calculate the exact duration between two dates in years, months, and days, plus total weeks / days / hours / minutes and business days. Optional time-of-day precision. 100% local.
Cron Generator
Build cron expressions from a friendly UI — every N minutes, daily at HH:MM, weekdays only, weekly, monthly, yearly. Preview the next 5 runs and a plain-English description. 100% local.