ISO 8601 Duration Converter
Developer Tools · Added
ISO 8601 durations are what APIs use when they mean a length of time rather than a moment — YouTube video lengths, Kubernetes timeouts, XML Schema fields. They are easy to read once and hard to remember, and this converts them in both directions.
Result
In words
1 hour 30 minutes
Written back in canonical form as PT1H30M
- Seconds
- 5,400.0000
- Minutes
- 90.0000
- Hours
- 1.5000
- Days
- 0.0625
- Weeks
- 0.0089
- Milliseconds
- 5,400,000
Exact
Exact
Exact
Exact
Exact
Exact
Components
- Years
- 0
- Months
- 0
- Weeks
- 0
- Days
- 0
- Hours
- 1
- Minutes
- 30
- Seconds
- 0
- ISO 8601 form
- PT1H30M
The letter M means months before the T and minutes after it — P1M is a month, PT1M is a minute, and that is the whole reason the T is mandatory. One more trap worth knowing: adding a month to a date is not the same as adding a month of seconds. 31 January plus one month is 28 February in most implementations, while adding the equivalent seconds lands on 2 March. Calendar arithmetic and elapsed time are different operations.
How to use the iso 8601 duration converter
- 1Paste an ISO duration such as PT1H30M, or switch the direction and type it in words.
- 2Read the totals in seconds, minutes, hours and days.
- 3Check the components table if you are checking a value field by field.
- 4Watch for the note about years and months, which do not have a fixed length.
Examples
An hour and a half
- Input
- PT1H30M
- Result
- 5,400 seconds · 90 minutes · 1.5 hours
The M problem
- Input
- P1M against PT1M
- Result
- One month against one minute — the T is the only difference
About the iso 8601 duration converter
Why a duration format exists at all
A number of seconds is unambiguous and unreadable: 5400 says nothing until you divide it. A string like "1h 30m" is readable and unparseable, because every codebase invents its own spelling. ISO 8601 durations are the compromise — one grammar, readable enough to check by eye, strict enough to parse without heuristics.
That is why they turn up wherever a duration crosses a boundary between systems: an API response, a configuration file, a database column, a message schema.
The fixed and the calendar-dependent parts
Weeks, days, hours, minutes and seconds are fixed quantities and convert to seconds exactly. Years and months are not quantities at all until anchored to a date, which is a genuine property of the calendar rather than a limitation of any parser.
The practical consequence is to keep them apart. A timeout, a cache lifetime or a retry interval should be expressed in the fixed units, where the value means exactly one thing. A billing period or a subscription term belongs in months, and should be applied by calendar arithmetic rather than converted to seconds at all.
Frequently asked questions
Why does M mean two different things?
How many seconds is P1M?
Is adding P1M to a date the same as adding a month of seconds?
What is the W component?
Related tools
Timestamp Converter
Developer Tools
Convert Unix timestamps to human dates and back, in local time and UTC.
Time Converter
Converters
Convert seconds, minutes, hours, days, weeks, months and years.
Cron Expression Generator
Developer Tools
Build or decode a cron expression, in plain English, with the next run times.