ISO 8601 Duration Converter

Paste a value like PT1H30M or P3DT4H5M6S. The M before the T means months, the M after it means minutes.

Seconds to an ISO duration

Going the other way. Stops at days, because a count of seconds cannot know which months you meant.

secondsPT1H30M

Where this format turns up

schema.orgPT1H30Mrecipe cookTime, video duration
YouTube Data APIPT4M13ScontentDetails.duration
KubernetesPT30Ssome CRD timeout fields
XML SchemaP1Y2M3DT4H5M6Sxs:duration
Azure and .NETP3DT4HTimeSpan round-trip format

PT1H30M in, ninety minutes out. And an honest answer when the duration contains months.

How to read an ISO 8601 duration

Every duration opens with P, for period. A T separates the date part from the time part, and each number is followed by a letter naming its unit.

  • PT1H30M is 1 hour 30 minutes
  • PT4M13S is 4 minutes 13 seconds
  • P3DT4H5M6S is 3 days, 4 hours, 5 minutes, 6 seconds
  • P1Y2M is 1 year 2 months
  • P2W is 2 weeks

The two Ms

M means months before the T and minutes after it. P1M is one month; PT1M is one minute. The two differ by about forty thousand times, which makes the missing T the most expensive single character in the format. If a scheduled job has been running once a month instead of once a minute, or the reverse, this is usually why.

Why P1M has no answer in seconds

Hours, minutes, seconds, days and weeks all have fixed lengths, so converting them is arithmetic. Years and months do not. One month is 28, 29, 30 or 31 days depending entirely on which month, so P1M has no length until you say when it starts.

Most converters quietly answer 2,592,000 seconds, which is thirty days, and is wrong eleven months of the year. This page does it the other way: give it a start date and it applies the duration to a real calendar and measures the result. From 1 January that is 31 days; from 1 February 2026 it is 28. Without a date it falls back to the mean Gregorian month of 30.44 days and labels the answer approximate rather than hiding it.

One month after 31 January

A related trap. Adding a month to 31 January has no obvious right answer, and naive date arithmetic overflows into 3 March, because 31 February gets normalised forward. The convention almost everything else follows is to clamp to the last day of the target month, giving 28 February, or 29 in a leap year. This page clamps. It is worth knowing which convention your own stack uses, because the two differ by three days and only ever at month ends.

ISO 8601 duration FAQs

What does PT1H30M mean?

One hour and thirty minutes. P opens every ISO 8601 duration, T separates the date part from the time part, and each number is followed by the letter naming its unit. So PT1H30M is 1 hour 30 minutes, PT4M13S is 4 minutes 13 seconds, and P3DT4H is 3 days 4 hours.

Why are there two Ms?

Because M means months before the T and minutes after it. P1M is one month. PT1M is one minute. They differ by roughly a factor of forty thousand, which makes it the most expensive typo in the format, and it is why the T is not optional decoration.

How many seconds is P1M?

There is no single answer. One month is 28, 29, 30 or 31 days depending on which month, so a duration containing years or months cannot be converted to seconds without knowing when it starts. Give this page a start date and it measures the real interval. Without one it falls back to the mean Gregorian month of 30.44 days and says so.

What is the difference between a duration and an interval?

A duration is a length with no position: PT1H30M is ninety minutes, whenever it happens. An interval is anchored to real time, written as two instants or an instant and a duration. The distinction matters exactly where calendar components are involved, since a month only has a length once you know where it sits.

Can a duration be negative?

ISO 8601 allows a leading minus, as in -PT1H, and .NET and Java both accept it. Some parsers do not, so it is worth checking what receives your value before relying on it.

Where will I meet this format?

schema.org uses it for recipe cookTime and video duration, which is why it matters for structured data. The YouTube Data API returns contentDetails.duration this way. XML Schema calls it xs:duration, .NET round-trips TimeSpan through it, and a number of Kubernetes CRDs use it for timeout fields.

What does P2W mean, and can I mix weeks with other units?

P2W is two weeks. Strict ISO 8601 treats the week form as exclusive, so P2W3D is not valid by the letter of the standard even though many parsers accept it. If you control both ends it usually works; if you do not, prefer P17D.

Is anything I paste sent to a server?

No. The parsing runs entirely in your browser and the page works offline.