ISO 8601 duration parser

ISO 8601 durations show up in APIs, video metadata, calendars and schedules. Paste one to see its parts and its length in seconds, minutes, hours and days, or enter a number of seconds to get the matching duration string.

Format PnYnMnWnDTnHnMnS, for example PT1H30M or P2W. Leave empty to convert seconds instead.
For example 5400 gives PT1H30M.
Normalised durationP3Y6M4DT12H30M5S
Total seconds110,550,605
Total minutes
1,842,510.083
Total hours
30,708.5014
Total days
1,279.5209
Years
3
Months
6
Weeks
0
Days
4
Hours
12
Minutes
30
Seconds
5

Years and months have no fixed length, so the totals count a year as 365 days and a month as 30 days.

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Type or paste a duration such as PT1H30M into the first box. The parts and totals appear at once.
  2. To go the other way, clear the first box and enter a number of seconds. The tool writes the duration string.

How it works

A duration is P, then optional years, months, weeks and days, then an optional T followed by hours, minutes and seconds. Each part is a number and a letter. The total is years × 365 × 86 400 + months × 30 × 86 400 + weeks × 604 800 + days × 86 400 + hours × 3 600 + minutes × 60 + seconds.

Worked examples

  • PT1H30M is 1 × 3 600 + 30 × 60 = 5 400 seconds.
  • P3Y6M is (3 × 365 + 6 × 30) = 1 275 days, which is 110 160 000 seconds under the 365 and 30 day convention.
  • P2W is 14 days, or 1 209 600 seconds.
  • 90 061 seconds is 1 day, 1 hour, 1 minute and 1 second: P1DT1H1M1S.

Good to know

Some systems accept only part of the standard. Weeks, for example, are often not allowed together with other parts, while this tool accepts them alongside years, months and days in the order the standard writes them.

Frequently asked questions

What does the T in an ISO 8601 duration mean?

The T separates the date part from the time part. M means months before the T and minutes after it, so P1M is one month and PT1M is one minute.

How long is P1M or P1Y in seconds?

It depends on the calendar date, so there is no single answer. This tool uses a fixed convention of 365 days for a year and 30 days for a month, and says so when months or years are present. Days, hours, minutes and weeks are exact.

Can a duration have a fraction?

Yes, but ISO 8601 allows a decimal fraction only on the smallest part, as in PT0.5S or P1.5D. A comma works as the decimal mark too.

Why does the reverse conversion never use months or years?

A number of seconds does not say which calendar months it spans, so the result uses days as the largest unit. 90061 seconds becomes P1DT1H1M1S.

More in Date & time

All tools in this category: Date & time ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.