No upload, 100% local, no account

ISO 8601 duration converter

Enter an ISO 8601 duration to break it down and convert it to seconds.

How ISO 8601 duration converter works

ISO 8601 Duration Converter parses and converts durations written in the ISO 8601 format (for example P1Y2M10DT4H30M) into a human-readable breakdown of years, months, days, hours, minutes and seconds, and also computes the total in seconds for the time components. Conversion runs entirely in your browser; nothing you type is transmitted to any server, and the tool functions offline once the page is loaded.

ISO 8601 duration strings start with a 'P' (for Period), followed by date components (Y for years, M for months, W for weeks, D for days) and optionally a 'T' separator followed by time components (H for hours, M for minutes, S for seconds). Weeks (W) are a special case: when present, no other date components may appear. The total-seconds output covers only the deterministic time portion (hours, minutes, seconds) because months and years have variable lengths in days and cannot be converted to seconds without a reference date.

How to use ISO 8601 duration converter, step by step

  1. Type or paste an ISO 8601 duration string into the input field (for example P3Y6M4DT12H30M5S).
  2. Read the component breakdown: years, months, weeks, days, hours, minutes, seconds.
  3. Check the total seconds value for the time portion (H/M/S components only).
  4. Alternatively, fill in the individual component fields and the ISO string is generated for you.

Common use cases

  • A developer is debugging an API response that returns durations in ISO 8601 format and needs to verify the parsed values.
  • A technical writer is documenting a system that accepts ISO duration strings and wants to show what each component means.
  • A data analyst needs to convert a set of ISO duration values from a database export into total seconds for statistical analysis.
  • A developer generating calendar or scheduling data needs to construct a valid ISO 8601 duration string from individual time component values.

Frequently asked questions

What does each letter in an ISO 8601 duration string mean?

P marks the start of the period. Y = years, M before the T separator = months, W = weeks, D = days. After the T separator: H = hours, M = minutes, S = seconds. The string P1Y2M10DT4H30M means 1 year, 2 months, 10 days, 4 hours and 30 minutes.

Why can the tool only convert hours, minutes and seconds to total seconds, not months and years?

Months vary from 28 to 31 days and years vary between 365 and 366 days. Without a reference start date, there is no single correct number of seconds for 'one month'. Hours, minutes and seconds have fixed lengths and convert deterministically. To get total seconds for a duration including months or years, use the date-add tool with a specific start date and compute the day difference.

What is the difference between PT1H30M and P0Y0M0DT1H30M?

They are semantically identical. Both represent a duration of 1 hour and 30 minutes. ISO 8601 allows omitting zero-value components, so PT1H30M is the compact form and P0Y0M0DT1H30M is an explicit form. Both are valid.

Can a duration string include weeks alongside days?

No. When the W (weeks) designator is used in an ISO 8601 duration, the standard prohibits other date designators (Y, M, D) in the same string. A weeks-only duration looks like P3W, meaning exactly 3 weeks.

Is the ISO duration string I type stored or sent anywhere?

No. The parsing is purely local string manipulation with no external dependencies. The duration string you enter stays within the browser tab and is not recorded, transmitted or cached beyond the session.

Are negative durations valid in ISO 8601?

The core ISO 8601 standard does not define negative durations. Some extended implementations allow a leading minus sign (e.g. -P1D to mean 'minus one day'). This tool parses standard non-negative durations; if your use case requires negative durations, verify the specific API or system you are working with to confirm its convention.