ISO 8601 Duration Converter
Read a duration such as P1DT12H, or write one from a number of seconds or a time.
Convert a duration
Enter an ISO duration, a number of seconds, or a time such as 1:30:00.
Needed only when the duration has years or months, which have no fixed length.
Plain numbers are seconds. Everything stays in your browser.
How to use this converter
- 1
Enter a duration. An ISO 8601 duration such as PT45M or P1Y2M10DT2H30M, a number of seconds such as 5400, or a time such as 1:30:00 or 1h 30m.
- 2
Add a start date if needed. Years and months have different lengths, so a duration with them is turned into days only from a start date.
- 3
Copy the result. Each form has a copy button: the total in seconds, minutes and hours, and the ISO string written two ways.
Examples
PT1H30M is 1 hour 30 minutes: 5,400 seconds. P1DT12H is 36 hours.
90061 seconds is PT25H1M1S, or P1DT1H1M1S with a 24-hour day.
P1M from January 31, 2026 ends on February 28, 2026: the month end is kept.
How it is calculated
An ISO 8601 duration starts with P. Date parts come next (Y years, M months, W weeks, D days), then T and the time parts (H hours, M minutes, S seconds). The M before T means months and after T means minutes. Only the last part may have a decimal fraction, as in PT1.5H.
Weeks, days, hours, minutes and seconds have fixed lengths here (a day is 24 hours), so they are added up exactly. Years and months are applied to the start date on the calendar instead: P1M from January 31 is February 28 (or 29). A leading minus sign, as in -PT15M, is a common extension and is accepted.
Reading a duration
| Duration | Meaning | Fixed length in seconds |
|---|---|---|
| PT30S | 30 seconds | 30 |
| PT15M | 15 minutes | 900 |
| PT1H30M | 1 hour 30 minutes | 5,400 |
| P1D | 1 day | 86,400 |
| P1W | 1 week | 604,800 |
| P1M | 1 month (depends on the start date) | — |
| P1Y2M3DT4H5M6S | 1 year, 2 months, 3 days, 4 h, 5 min, 6 s | — |
| PT0S | Zero duration | 0 |
Months and years have no fixed length in seconds, so they only make sense when you add them to a start date. A day is also calendar-based when time zones are involved: adding P1D across a clock change gives the same local time next day, which can be 23 or 25 hours later.
Where durations are used
| Place | Example | Notes |
|---|---|---|
HTML <time> | datetime="PT4M13S" | Machine-readable length of a video or recipe |
| Schema.org | cookTime: "PT45M" | Recipes, videos, events |
| YouTube Data API | contentDetails.duration: "PT4M13S" | Video length |
| XML Schema | xs:duration | Allows P…Y…M…DT…H…M…S |
| Calendar (iCalendar) | DURATION:PT1H | Event length and alarm triggers |
Tips
- Always start with P. A time-only duration needs PT:
PT90M, notP90M(which is 90 months). - Use the smallest fixed units when you need an exact length (PT36H instead of P1DT12H if “day” should not depend on daylight saving).
- Fractions are allowed on the smallest unit only:
PT0.5S,P0.5Y; many libraries do not accept them.
Free downloads
Plain files you can keep, print or open in a spreadsheet. They are the same figures used on this page.
Questions
What does PT0S mean?
A duration of zero: P for period, T for the time part, and 0 seconds.