Loading Techie Utils…

ISO 8601 Duration Converter

Convert between ISO 8601 durations, seconds, clock time and plain words. Free, and runs entirely in your browser — nothing you enter is uploaded or stored.

About Duration Converter

The same length of time is written differently everywhere. APIs, YouTube, schema.org and XML Schema use ISO 8601 durations such as PT1H30M. Code usually stores seconds or milliseconds, people read 1:30:00, and people type "1h 30m". This reads any of those and writes all of them.

ISO 8601 durations are parsed completely: years, months, weeks, days, hours, minutes and seconds, a fraction on the last unit, and a leading minus sign. Clock times with or without an hour field, a plain number of seconds, and written units such as "2 days 4 hours" or "90 min" are read too.

Years and months have no fixed length, so a duration that uses them can only be converted to seconds approximately. The tool uses the average Gregorian year and month and marks the result as approximate. For an exact answer, add the duration to a real date with the date calculator.

Where it helps

  • Reads ISO 8601, clock times, seconds and written units, detected automatically.
  • Writes the ISO 8601 form that APIs and schema.org expect, from days down.
  • Marks conversions that involve years or months as approximate, and says what average was used.
  • Shows the whole duration in each unit, from weeks down to seconds.

Limits

  • A day is counted as 24 hours, which is not true across a daylight-saving change. For calendar arithmetic, use the date calculator.
  • ISO 8601 alternative formats such as P0003-06-04T12:30:05 are not read.

Frequently asked questions

What does PT1H30M mean?

An ISO 8601 duration of 1 hour and 30 minutes. P starts the duration, T separates the date part (years, months, weeks, days) from the time part (hours, minutes, seconds). The M before T means months, and the M after T means minutes.

How many seconds are in a month?

It depends on the month, which is why a month cannot be converted exactly. On average a Gregorian month is 30.436875 days, or 2,629,746 seconds, and that is the value used here, with the result marked approximate.

How do I write a duration longer than 24 hours as clock time?

Let the hours run past 24: 27 hours and 5 minutes is 27:05:00. That is how the clock form is written here, since days would need a separate field that most clock-time parsers do not read.

Related tools

More Date & Time tools