Time/Numbers

ISO 8601 Duration Parser

Parse a string like "P3Y6M4DT12H30M5S" into a readable breakdown, or build one from years/months/days/hours/minutes/seconds.


                        

An ISO 8601 duration (e.g. P3Y6M4DT12H30M5S) is a compact, unambiguous way to write a time span, used by many APIs and data formats, but hard to read without parsing it. This tool translates such a string into plain language and lets you build one from separate fields.

How to use it

Common uses

Things to keep in mind

The leading P stands for "period" and is required, just like the T that separates days from hours in the time part.

The base standard doesn't define a sign for durations — negative durations (to mean "ago") are only supported by specific implementations as an unofficial extension.

Article about this tool: ISO 8601 duration: how to write a duration in a standard format

Frequently asked questions

What does a string like P3Y6M4DT12H30M5S mean?

This is the standard ISO 8601 duration format: P means "period," followed by years/months/days up to the letter T, after which come hours/minutes/seconds. In this example, that's 3 years, 6 months, 4 days, 12 hours, 30 minutes, and 5 seconds.

How does an ISO duration differ from a simple duration in hours?

Unlike fixed units (as in the duration calculator), the "years" and "months" components here are calendar-based and don't have a fixed number of seconds — their exact length depends on the specific dates they're applied to.

Is the week format P4W supported?

Yes, but only when parsing an existing string. When building your own string, weeks need to be expressed in days, since ISO 8601 doesn't allow combining weeks with other components in a single string.

Can I specify fractional seconds or minutes?

Yes, the standard allows a fractional part only on the last component of the string — for example PT1.5S (1.5 seconds) or PT1H30.5M (1 hour 30.5 minutes) are valid, while a fractional part on any non-final component isn't.

Are negative ISO durations a thing?

The base ISO 8601 standard doesn't define a sign for durations, but some implementations (including this tool) support a leading minus to mean "ago" or a reversed duration — a common, though unofficial, extension.

Articles: Time/Numbers

Unix time: why computers count time from 1970

Why January 1, 1970 became the reference point for time in most computer systems.

Cron expressions: how to decode a task schedule

How to decode an expression like */15 * * * * and know exactly when the job will run.

Number systems: why binary, octal, and hexadecimal exist

Why the color #FF5733 in CSS is written in hexadecimal digits instead of decimal.

Bitwise operations: how AND, OR, and XOR work at the bit level

How bitwise AND differs from logical AND, and why you'd operate on individual bits of a number at all.

Date difference: why counting days is trickier than it looks

Why naively subtracting dates can give the wrong result because of leap years.

Age calculation: why it's not just subtracting years

Why simply subtracting birth years can give an age one year higher than the real one.

Time zones: why UTC isn't the same thing as GMT

Why UTC never changes twice a year, while London time (GMT/BST) does.

Duration calculator: how to correctly add up hours, minutes, and seconds

Why adding minutes and seconds requires "carrying" the remainder to the next place, just like in decimal addition.

Week number: why different countries count weeks differently

Why January 1 sometimes falls into week 52 or 53 of the previous year under the ISO 8601 standard.

Roman numerals: how a system with no zero and no place value works

Why IV means 4, not 6, and how the subtraction rule works in Roman numerals.

IEEE 754: why 0.1 + 0.2 doesn't equal 0.3 in code

Why almost every programming language prints 0.1 + 0.2 as 0.30000000000000004.

Number to words: why turn digits into text

Why bank documents write an amount both in digits and in words at the same time.