search

Found

info Overview

Parse ISO 8601 durations (PnYnMnDTnHnMnS or PnW) into total seconds, milliseconds, minutes and hours, with a component breakdown and human-readable form.

📘 How to Use

  1. Type a duration string such as P1Y6M14DT12H30M45S into the field
  2. Switch the days-per-year basis (365 / 365.25 / 366)
  3. Read the total seconds, minutes, hours and the component breakdown

ISO 8601 Duration Parser

Format: PnYnMnDTnHnMnS or PnW (n may be a decimal)

※ P starts the duration. Components after T are time (H/M/S). Week form PnW stands alone and cannot mix with other designators.

※ Years and months are approximated using the days-per-year basis (1 month = 1 year / 12). For exact calendar deltas use date arithmetic.

Total seconds
s
Total milliseconds
ms
Total minutes
min
Total hours
h

Components

Y
0
M
0
D
0
H
0
M
0
S
0

Human-readable

Copied!
Article

ISO 8601 Duration Parser|PnYnMnDTnHnMnS to Seconds, Minutes, Hours

Paste an ISO 8601 duration like P1Y6M14DT12H30M45S, PT1H30M or the week form P1W and get total seconds, milliseconds, minutes and hours at once. Each Y/M/D/H/M/S component is split out alongside a human-readable line.

💡 About this tool

If you live in cron schedulers, Kubernetes liveness probes, OpenAPI format: duration fields or RFC 3339 APIs, strings like PT30M and P3DT4H show up constantly. You can read them fine — but "okay, how many seconds is that actually?" is annoying to do in your head, and it's easy to fumble the Y/M/D unit boundaries and end up an order of magnitude off.

This parser takes the raw string and shows total seconds, milliseconds, minutes and hours in four cards simultaneously. It also breaks the value into its six Y·M·D·H·M·S components so you can see the ISO 8601 structure directly — everything before T is the date part, everything after is the time part. For durations that span months or years, you can flip the "days per year" basis between 365, 365.25 and 366 to compare a leap-aware estimate against a plain 365-day one side by side.

🧐 Frequently Asked Questions

Q. How many seconds is P1Y ("one year")? It depends on the days-per-year basis you pick: 31,536,000 s at 365 days, 31,557,600 s at 365.25. Months are approximated as one year divided by twelve.

Q. Why are years and months "approximate"? ISO 8601 durations are nominal and calendar-independent — a real month is anywhere from 28 to 31 days. If you need an exact delta from a specific start date, you need calendar arithmetic, not a fixed-length conversion.

Q. Does the week form P1W work? Yes. P1W converts as 7 days = 604,800 seconds. The week form must stand alone, though — you can't mix it with other designators like P1Y2W.

Q. Can I enter decimals? Yes. Values with a decimal point (or comma) such as PT1.5H or PT0.5S are parsed.

Q. Are negative durations (-PT1H) supported? No. A string that starts with a minus sign is rejected as an error here.

Q. What happens if I forget the T? P1M means one month; PT1M means one minute. M is months in the date part and minutes in the time part, so if you mean minutes, always put it after T.

📚 Quirks of ISO 8601 duration notation

ISO 8601 durations start with P (for Period) because they describe a length, not a moment in time. The T separates the time part, and without it M is ambiguous — that single character is exactly why P1M and PT1M mean completely different things.

In practice you hit this format more often than you'd expect: timeout configs, retry intervals, and media metadata all lean on it. The YouTube Data API, for instance, returns contentDetails.duration as strings like PT4M13S. Whether you write "30 minutes" as PT30M or PT0.5H is up to you, but most teams keep things integer and use the smallest natural unit for machine-friendliness. When a third-party tool hands you a duration string in a config file, converting it to plain seconds in one shot is the fastest way to sanity-check the value before it goes live.