Unit & Format Converters

ISO 8601 Duration Converter Inputs

Results

Result —
Secondary —
Details —

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. 1. List the components

    Write the duration in parts, such as 1 day, 2 hours, 30 minutes, 15 seconds.

  2. 2. Start with P

    Begin every ISO duration with P.

  3. 3. Add date and time parts

    Write date parts before T and time parts after T: P1DT2H30M15S.

  4. 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 DurationISO 8601Total Seconds
30 secondsPT30S30
15 minutesPT15M900
1 hour 30 minutesPT1H30M5,400
8 hoursPT8H28,800
1 dayP1D86,400
1 day 2 h 30 m 15 sP1DT2H30M15S95,415
2 weeksP2W1,209,600
1.5 secondsPT1.5S1.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.