duration.tools

ISO 8601 Duration Converter

PT1H30M, decoded and generated.

Free, no sign-upRuns in your browser — nothing is uploadedUpdated

Plain duration
1 d 2 h 30 min 0 s
95,400 seconds
ISO 8601
P1DT2H30M
Seconds
95,400
hh:mm:ss
26:30:00

PT1H30M is ISO 8601 for “one hour thirty minutes” — the duration syntax used by YouTube's API, schema.org markup, and countless REST payloads. Paste one to decode it, or enter plain time to generate the ISO string.

ISO 8601 duration examples

ISO 8601Meaning
PT30S30 seconds
PT15M15 minutes
PT1H30M1 hour 30 minutes
PT1.5H1.5 hours (1 hour 30 minutes)
P1D1 day
P1DT12H1 day 12 hours
P2W2 weeks
P3M3 months
P1Y2M10DT2H30M1 year, 2 months, 10 days, 2 hours, 30 minutes

Reading the ISO 8601 duration format

An ISO 8601 duration starts with P (period), lists date parts as nY, nM, nW and nD, then a T, then time parts as nH, nM and nS. Parts that are zero are left out. So P1DT2H30M is 1 day, 2 hours and 30 minutes, and PT45S is 45 seconds.

M means months before the T and minutes after it — P1M is a month, PT1M is a minute. Only the smallest unit may carry a decimal, as in PT1.5H or PT0.25S.

Where you'll meet it

The YouTube Data API returns video lengths as ISO durations (contentDetails.duration). Schema.org uses them for recipe cook times, video and course lengths (cookTime, duration). Java's java.time.Duration, .NET's XmlConvert and Postgres intervals all read and write the format.

How to use it

  1. 1.Paste an ISO 8601 duration (P1DT2H30M) to decode it.
  2. 2.Or type a plain duration (1d 2h 30m) to encode it.
  3. 3.Copy either representation.

Questions people ask

What does the T in PT1H30M mean?
It separates date units from time units. P1M is one month; PT1M is one minute. The T is required before any hours, minutes or seconds.
How are months and years converted?
ISO 8601 leaves their exact length to context; this tool uses the common conventions of 30-day months and 365-day years and notes when they're in play.
How do I convert a YouTube API duration to seconds?
Paste the contentDetails.duration value, such as PT4M13S, and read the seconds — 253 in that case. Hours, minutes and seconds are multiplied by 3600, 60 and 1 and added.