The Duration Formatter converts time spans between ISO 8601 durations like PT1H30M, plain seconds or milliseconds, hh:mm:ss clock notation and readable text such as "1 hour, 30 minutes". Type any of them and see every other form at once, with totals in minutes, hours and days. Everything runs in your browser — nothing is uploaded.
How to convert an ISO 8601 duration
- Type a duration in any supported form:
P1DT2H30M15S,5415,90000 ms,01:30:00,1h 30mor2 hours and 15 minutes. - Read the result table. The ISO 8601 form, a normalized ISO form, long and short human text,
hh:mm:ss, and totals in seconds, milliseconds, minutes, hours and days are all shown together. - Copy the row you need. Each output has its own Copy button.
Examples
These values do not depend on the date or time zone, so they are the same wherever you open the page.
An ISO 8601 duration
Input P1DT2H30M15S — one day, two hours, thirty minutes and fifteen seconds:
| Output | Value |
|---|---|
| Human | 1 day, 2 hours, 30 minutes, 15 seconds |
| Short | 1d 2h 30m 15s |
| hh:mm:ss | 26:30:15 |
| Total seconds | 95415 |
| Total minutes | 1590.25 |
| Total hours | 26.504 |
Seconds to hours and minutes
Input 5415 (a video length or a job runtime in seconds):
| Output | Value |
|---|---|
| ISO 8601 | PT1H30M15S |
| Human | 1 hour, 30 minutes, 15 seconds |
| hh:mm:ss | 01:30:15 |
| Total milliseconds | 5415000 |
| Total hours | 1.504 |
Normalizing an overflowing duration
Input PT90M. ISO 8601 allows 90 minutes; the normalized form carries them into hours:
| Output | Value |
|---|---|
| ISO 8601 | PT90M |
| ISO 8601 (normalized) | PT1H30M |
| Human | 90 minutes |
| Short | 1h 30m |
Months are approximate
Input P1M. A month has no fixed length, so totals use the average Gregorian month and a notice says so: "Years and months vary in length; totals use average lengths (365.2425 days, 30.44 days)."
| Output | Value |
|---|---|
| ISO 8601 (normalized) | P30DT10H29M6S |
| Total seconds | 2629746 |
| Total days | 30.4369 |
Options explained
The Duration Formatter is a form, so it has no settings drawer. These are the parts of the page:
- Duration input — accepts ISO 8601 (
P1Y2M3W4DT5H6M7S, including decimals such asPT1.5Hand a leading minus), bare numbers as seconds, numbers withmsas milliseconds,hh:mm:ssormm:ssclock values, and unit phrases (3d 4h,2.5h,45s,2 hours and 15 minutes). - ISO 8601 and ISO 8601 (normalized) — the duration as written, and re-expressed in days, hours, minutes and seconds.
- Human and Short — "1 hour, 30 minutes" and "1h 30m". Where the browser supports
Intl.DurationFormat, it is used for the wording. - hh:mm:ss — clock notation; hours are not wrapped at 24, so a day and a half is
36:00:00. - Totals — the whole span in seconds, milliseconds, minutes, hours and days.
Common duration problems
"Couldn't read this duration"
The input matches none of the supported forms. Try PT1H30M, 5400, 01:30:00 or 1h 30m. A lone P or PT with no parts is not a duration, and neither is text with units the parser does not know.
1:30 became 90 seconds
Two-part clock values are read as minutes and seconds, like a track length. For one hour thirty minutes, write 1:30:00, PT1H30M or 1h 30m.
PT1M versus P1M
Without the T, M means months. P1M is about 30.44 days; PT1M is 60 seconds. This is a frequent mistake when writing durations by hand.
Negative durations
A duration like -PT45M keeps its sign in every row: ISO (-PT45M), clock (-00:45:00), totals (-2700), and the Human and Short rows ("−45 minutes", "−45m"). The word rows use the typographic minus sign U+2212, so if you paste them into code or a spreadsheet that expects a hyphen-minus, take the ISO or totals row instead.
Totals for years look slightly off
A year is counted as 365.2425 days and a month as 30.44 days on average. For exact calendar arithmetic — adding one month to 31 January — use date functions in your language, not a fixed number of seconds.
FAQ
What does PT1H30M mean?
It is an ISO 8601 duration: P starts the period, T starts the time part, and 1H30M means one hour and thirty minutes — 5,400 seconds. The format is used by YouTube's API, Schema.org metadata, iCalendar, Java's Duration, .NET's XmlConvert and many JSON APIs.
How do I convert seconds to hours, minutes and seconds?
Type the number of seconds. 5415 shows as 01:30:15, "1 hour, 30 minutes, 15 seconds" and PT1H30M15S. In code, hours are Math.floor(s / 3600), minutes Math.floor(s % 3600 / 60) and seconds s % 60.
How do I convert milliseconds to minutes?
Type the value followed by ms, such as 90000 ms. The table shows 1.5 total minutes, "1 minute, 30 seconds" and PT1M30S. Without the ms suffix, a bare number is read as seconds.
How do I parse ISO 8601 durations in code?
Java has Duration.parse("PT1H30M") for time-based durations and Period.parse for date-based ones. Python's standard library has no parser; the isodate package provides parse_duration. In JavaScript, Temporal.Duration.from("PT1H30M") is available where Temporal is supported. Months and years need a reference date to become an exact number of seconds.
Why does P1D not always equal 24 hours?
In calendar arithmetic, a day can be 23 or 25 hours when a time zone changes to or from daylight saving time, so P1D added to a date keeps the wall-clock time. This formatter measures spans in fixed units, counting a day as 86,400 seconds, which is what timers and video lengths need.
Is my input sent anywhere?
No. Parsing and formatting happen in your browser inside an isolated frame that blocks network requests, and nothing is stored unless you turn on "Remember my last input".
ISO 8601 duration syntax
| Part | Meaning | Example |
|---|---|---|
P |
Period marker, always first | P3D |
nY nM nW nD |
Years, months, weeks, days | P1Y2M, P2W |
T |
Separates date and time parts | P1DT12H |
nH nM nS |
Hours, minutes, seconds | PT1H30M, PT0.5S |
M means months before T and minutes after it: P1M is a month, PT1M a minute. ISO 8601 explained covers intervals and the rest of the standard.
Related tools
Convert a single instant with the Unix Timestamp Converter, format it with the Date Formatter, or express it as "in 3 days" with the Relative Time Formatter. All date tools are in Date & Number.
Related tools
Guides
- ISO 8601 Date Format Explained — What does an ISO 8601 date look like?