Date & time · Parser
ISO 8601 duration parser.
Check a duration such as P3Y6M4DT12H30M5S against the RFC 3339 grammar, see its parts, total seconds and plain-English text, or build one like PT1H30M. Runs in your browser; nothing is sent anywhere.
Input
Builder
Result
Enter a duration and press Parse.
How an ISO 8601 duration is checked
A duration is P, then date units in the order years, months, days (Y, M, D), then optionally T and time units hours, minutes, seconds (H, M, S). M means months before the T and minutes after it. Weeks are a separate form, P2W. Examples: P1Y2M3D, PT1H30M, P3Y6M4DT12H30M5S.
What is rejected: P and PT (no component), P1YT (a T with no time unit), and, in RFC mode, weeks mixed with other units such as P1W2D.
RFC 3339 nesting is strict. In the Appendix A grammar a year may be followed only by a month, a month only by a day, an hour only by a minute, and a minute only by a second. So P1Y2D and PT1H30S are not in that grammar even though many libraries accept them. Extended mode accepts them and marks them.
Beyond RFC 3339: ISO 8601 and ECMAScript Temporal also allow a leading sign and a decimal fraction (period or comma, up to 9 digits in Temporal) on the smallest unit, and Temporal allows a fraction only on hours, minutes or seconds. Extended mode follows the Temporal grammar and labels each of these as beyond RFC 3339.
Total seconds: weeks, days, hours, minutes and seconds are converted exactly, counting a day as 24 hours. Years and months are calendar-relative (a month is 28 to 31 days), so the total is shown only when you pick a length for them.
Sources: RFC 3339, Appendix A (ISO 8601 collected ABNF), used as the free authority because ISO 8601-1 itself is paywalled, and the ECMAScript Temporal specification (TemporalDurationString grammar) for the extended forms.
Frequently asked questions
How do I write 90 minutes?
PT90M or PT1H30M. Both are valid; the parser does not force minutes below 60.
What is the difference between P1M and PT1M?
P1M is one month. PT1M is one minute. The T is what switches to time units.
Why is there no total for P1Y?
A year is 365 or 366 days and a month is 28 to 31, so the exact number of seconds depends on the start date. Choose a length in the form if you want an estimate.
Is P1W2D valid?
Not under RFC 3339 Appendix A, where a week duration stands alone. ECMAScript Temporal accepts it, so Extended mode does and marks it as beyond RFC 3339.
Format check only
This tool checks that a string is a well-formed duration under the grammar you pick. It cannot tell you whether a system that receives the value will accept it. Nothing you type is stored or sent anywhere.