ISO 8601 Duration Converter
Convert supported duration components into standardized notation.
How ISO 8601 Duration Converter Works?
The ISO 8601 Duration Converter works by mapping each time component to a letter code inside the PnYnMnDTnHnMnS pattern. The P marks a period and the T separates date parts from time parts.
-
1. List the components
Write the duration in parts, such as 1 day, 2 hours, 30 minutes, 15 seconds.
-
2. Start with P
Begin every ISO duration with P.
-
3. Add date and time parts
Write date parts before T and time parts after T: P1DT2H30M15S.
-
4. Check total seconds
Convert to seconds with the widget: 1 day + 2.5042 hours = 95,415 seconds.
ISO 8601 Duration Converter Formula
The ISO 8601 Duration Converter formula is P[n]Y[n]M[n]W[n]DT[n]H[n]M[n]S, and total seconds for fixed parts equal D × 86,400 + H × 3,600 + M × 60 + S.
- P = period designator (always first)
- Y, M, W, D = years, months, weeks, days
- T = time designator
- H, M, S = hours, minutes, seconds
- Fixed seconds = W × 604,800 + D × 86,400 + H × 3,600 + M × 60 + S
Example: 1 day 2 hours 30 minutes 15 seconds = P1DT2H30M15S (95,415 seconds).
ISO 8601 Duration Converter Conversion Table
The ISO 8601 Duration conversion table shows plain-language durations, the ISO code, and total seconds.
| Plain Duration | ISO 8601 | Total Seconds |
|---|---|---|
| 30 seconds | PT30S | 30 |
| 15 minutes | PT15M | 900 |
| 1 hour 30 minutes | PT1H30M | 5,400 |
| 8 hours | PT8H | 28,800 |
| 1 day | P1D | 86,400 |
| 1 day 2 h 30 m 15 s | P1DT2H30M15S | 95,415 |
| 2 weeks | P2W | 1,209,600 |
| 1.5 seconds | PT1.5S | 1.5 |
What is ISO 8601 Duration Converter?
An ISO 8601 Duration Converter is a tool that turns durations into the standard text format defined by ISO 8601, such as PT1H30M for 1 hour 30 minutes.
ISO 8601 durations appear in YouTube Data API responses, schema.org markup (cookTime, duration), XML Schema, and calendar files. A video length of 4 minutes 13 seconds arrives as PT4M13S.
The letter M has 2 meanings. M before T means months, and M after T means minutes. P1M is 1 month and PT1M is 1 minute.
What are the uses of ISO 8601 Duration Converter?
There are 5 main uses of the ISO 8601 Duration Converter, including schema markup, API parsing, and calendar files.
Schema markup
SEO teams write recipe cookTime as PT45M in structured data.
API parsing
Developers convert YouTube PT4M13S values into 253 seconds.
Calendar files
Developers write event lengths in iCalendar DURATION fields.
Data exchange
Engineers exchange durations between systems in 1 standard format.
Video metadata
Publishers add VideoObject duration values for search results.