Time/Numbers
ISO 8601 Duration Parser
Parse a string like "P3Y6M4DT12H30M5S" into a readable breakdown, or build one from years/months/days/hours/minutes/seconds.
An empty field counts as 0; zero fields are left out of the string. The week component (P4W) is parse-only — use days to build.
An ISO 8601 duration (e.g. P3Y6M4DT12H30M5S) is a compact, unambiguous way to write a time span, used by many APIs and data formats, but hard to read without parsing it. This tool translates such a string into plain language and lets you build one from separate fields.
How to use it
- Parse: paste an ISO duration string to get years, months, days, hours, minutes, and seconds broken out separately, in a readable form.
- Build: enter the duration components you need and the tool assembles a valid ISO 8601 string.
- The letter T before the time part (hours/minutes/seconds) is required and gets added automatically when needed.
Common uses
- Reading a duration field from an API response (a subscription, a rental period, a timeout) given in this format.
- Building a correctly formatted ISO 8601 string for a request that expects a duration in exactly this format.
- Debugging why a third-party API's parser rejects a hand-built duration — checking it against the standard's exact syntax.
Things to keep in mind
The leading P stands for "period" and is required, just like the T that separates days from hours in the time part.
The base standard doesn't define a sign for durations — negative durations (to mean "ago") are only supported by specific implementations as an unofficial extension.
Article about this tool: ISO 8601 duration: how to write a duration in a standard format
Frequently asked questions
What does a string like P3Y6M4DT12H30M5S mean?
This is the standard ISO 8601 duration format: P means "period," followed by years/months/days up to the letter T, after which come hours/minutes/seconds. In this example, that's 3 years, 6 months, 4 days, 12 hours, 30 minutes, and 5 seconds.
How does an ISO duration differ from a simple duration in hours?
Unlike fixed units (as in the duration calculator), the "years" and "months" components here are calendar-based and don't have a fixed number of seconds — their exact length depends on the specific dates they're applied to.
Is the week format P4W supported?
Yes, but only when parsing an existing string. When building your own string, weeks need to be expressed in days, since ISO 8601 doesn't allow combining weeks with other components in a single string.
Can I specify fractional seconds or minutes?
Yes, the standard allows a fractional part only on the last component of the string — for example PT1.5S (1.5 seconds) or PT1H30.5M (1 hour 30.5 minutes) are valid, while a fractional part on any non-final component isn't.
Are negative ISO durations a thing?
The base ISO 8601 standard doesn't define a sign for durations, but some implementations (including this tool) support a leading minus to mean "ago" or a reversed duration — a common, though unofficial, extension.