ISO 8601 Duration Converter

Read a duration such as P1DT12H, or write one from a number of seconds or a time.

Timestamp tool

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.

DURATION
—
—

How to use this converter

  1. 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. 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. 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

Anatomy of an ISO 8601 durationP1Y2M3DT4H5M6S: P for period, then years, months, days, the letter T, then hours, minutes and seconds.Pperiod1Yyears2Mmonths3DdaysTtime4Hhours5Mminutes6Sseconds
The letter M means months before the T and minutes after it. Everything before T is a calendar part, everything after is clock time.
Examples
DurationMeaningFixed length in seconds
PT30S30 seconds30
PT15M15 minutes900
PT1H30M1 hour 30 minutes5,400
P1D1 day86,400
P1W1 week604,800
P1M1 month (depends on the start date)—
P1Y2M3DT4H5M6S1 year, 2 months, 3 days, 4 h, 5 min, 6 s—
PT0SZero duration0

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

Common uses
PlaceExampleNotes
HTML <time>datetime="PT4M13S"Machine-readable length of a video or recipe
Schema.orgcookTime: "PT45M"Recipes, videos, events
YouTube Data APIcontentDetails.duration: "PT4M13S"Video length
XML Schemaxs:durationAllows P…Y…M…DT…H…M…S
Calendar (iCalendar)DURATION:PT1HEvent length and alarm triggers

Tips

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.