DataToolsLab
Date & Time Tools

ISO 8601 Duration Parser & Builder

Parse ISO 8601 durations like PT1H30M and build your own.

Loading tool…

What is ISO 8601?

Durations in ISO 8601 (the PnYnMnDTnHnMnS syntax) are common in APIs and video metadata. This tool parses them into plain-language spans and builds new ones.

How it works

A regex-based parser reads the P/T sections and unit letters, validating ordering and returning the total time in each unit.

  1. Enter your input. Type or paste your input into the field above — the tool responds instantly.
  2. Review the result. Output updates live as you type. Everything runs entirely in your browser.
  3. Copy or download. Use the Copy button to grab the result, or Download to save it as a file.

Examples

PT1H30M

The ISO 8601 duration PT1H30M expands to 1 hour and 30 minutes — the notation used in video timestamps, media APIs, and expiry fields.

Common mistakes

P1Y is not exactly 365 days

In ISO 8601, P1Y means one calendar year, which varies in days. For fixed-length intervals use days (P365D) or weeks (P52W).

Frequently asked questions

What does the P stand for?

P marks the period and always leads. T separates the date portion (years, months, days) from the time portion (hours, minutes, seconds).

Can I build a duration from plain language?

Yes — enter "2 weeks and 3 days" and the builder produces P2W3D with the equivalent in days shown.

Is a missing value treated as zero?

Yes, and the parser flags empty components like PT (no time) as invalid rather than guessing.

Online