ISO 8601 Duration Converter
Convert ISO 8601 duration notation (e.g. PT1H30M) to and from total seconds. Handy for decoding formats used by the YouTube API, AWS timeout settings, and podcast RSS feeds.
Common ISO 8601 Duration Examples
An ISO 8601 duration starts with "P", followed by years/months/days, then "T" followed by hours/minutes/seconds. Below are common examples and the seconds they represent.
| Notation | Total seconds | Note |
|---|---|---|
| PT30S | 30 | A typical short timeout value, such as 30 seconds |
| PT1H30M | 5,400 | 1 hour 30 minutes — a common way to express movie runtimes or YouTube video lengths |
| P1D | 86,400 | 1 day (24 hours) — often used for log retention periods or cache expiry settings |
| P3Y6M4DT12H30M5S | 110,842,205 | A combined example equal to 3 years, 6 months, 4 days, 12 hours, 30 minutes and 5 seconds (years/months use the 365.25-day approximation) |
What Is ISO 8601 Duration Notation?
ISO 8601 duration notation is an international standard for expressing the "length" between two points in time as a single string, such as "P3Y6M4DT12H30M5S". While a date-time points to a specific "when", a duration expresses "how long" — a difference rather than a single instant — which is why a dedicated notation starting with "P" exists separately from timestamp formats.
Developers run into this notation constantly: the YouTube Data API reports video length this way, AWS and Google Cloud APIs use it for timeout and expiry settings, and podcast RSS feeds use it for episode length. This tool converts between duration strings and total seconds instantly, so you can see exactly how long a value really represents.
How to Convert ISO 8601 Durations and Seconds
- Paste a duration string to convert it to seconds Enter an ISO 8601 duration string such as "PT1H30M" into the top text box, and the total seconds and a per-unit breakdown appear automatically.
- Try the sample value Click "Insert sample" to load an example that combines years, months, days, hours, minutes, and seconds, so you can see the conversion in action right away.
- Enter seconds to convert them to a duration string Type the total number of seconds you want to convert into the bottom text box, and the matching ISO 8601 duration string is generated.
- Choose a conversion mode Select "years/months/days" for a compact, readable notation, or "days/hours/minutes/seconds only" for an exact result with no calendar approximation.
- Copy the result Copy the displayed total seconds, minutes, hours, or days — or the generated duration string — directly into your API request or config file.
Tips for getting more out of it
- Durations that include years or months don't have a fixed number of seconds in reality, so this tool uses a fixed approximation: 1 year = 365.25 days and 1 month = 30.44 days.
- When generating a duration string from seconds, choose "days/hours/minutes/seconds only" to avoid the year/month approximation entirely and get an exact, calendar-independent result.
- The YouTube Data API returns video length in the contentDetails.duration field using ISO 8601 notation, so you can paste it directly here to get the total seconds.
- Cloud services such as AWS Lambda and API Gateway sometimes use ISO 8601 duration notation for timeout configuration, which makes this tool useful for verifying those settings.
- Podcast RSS feeds occasionally use ISO 8601 duration format for the itunes:duration tag in addition to the more common hh:mm:ss format.
Where ISO 8601 Duration Conversion Comes in Handy
Parsing YouTube Data API responses
Paste a value like "PT4M13S" from contentDetails.duration to instantly see how many minutes and seconds a video runs.
Debugging AWS and cloud service settings
Check what a duration notation in a Step Functions or CloudFormation timeout setting actually translates to in seconds or hours.
Checking podcast RSS episode length
When the itunes:duration tag uses ISO 8601 format, compare it against the more familiar hh:mm:ss notation to confirm the runtime.
Integrating with calendar and scheduling APIs
Work backward from a number of seconds to build the recurrence interval or reminder duration required by APIs such as Google Calendar.
Building test fixtures for a custom parser
If you are writing your own duration parser, use this tool to verify the correct number of seconds for known duration strings and use them as test expectations.
ISO 8601 Duration Glossary
- ISO 8601
- An international standard that defines how to represent dates, times, and durations. Besides date notation like "2026-09-16", it also defines the duration notation this tool handles.
- Duration
- A value representing the length of time between two points. Unlike a date-time, which points to a single moment, a duration carries information about how much time elapses.
- PnYnMnDTnHnMnS notation
- The basic format of ISO 8601 duration strings: years (Y), months (M), and days (D) after "P", followed by hours (H), minutes (M), and seconds (S) after "T", including only the units that are needed.
- Timestamp
- A value representing one specific point in time. Unlike a duration (a difference), a timestamp expresses an absolute position — "when" something occurred.
- RFC 3339
- A specification, based on ISO 8601, for expressing date-times on the internet. It defines timestamp notation but not duration notation, which remains unique to ISO 8601.
- Week notation (PnW)
- A shorthand like "P2W" that expresses a duration purely in weeks. Under ISO 8601, this standalone form cannot be combined with year/month/day or time-of-day components.
Frequently Asked Questions
Side Note — Why does the computing world have a dedicated format for "durations"?
ISO 8601 is best known as the international standard for representing calendar dates and times, but the same standard also defines a separate notation for "durations" — the length of time between two points, rather than a single point in time. A date-time answers "when," while a duration answers "how long," and even though the two look similar at a glance, they represent fundamentally different kinds of information. The dedicated "P"-prefixed notation exists precisely to keep that distinction clear.
One reason duration notation is so useful in practice is that it prevents unit-mismatch bugs when data is exchanged between systems. If an API response simply returned the number "30", a caller would have to consult documentation to know whether that meant seconds or minutes. With "PT30S", the value and its unit travel together in a single string, so a correct parser can never misinterpret it.
This is exactly why the YouTube Data API returns video length in ISO 8601 format: a string like "PT4M13S" unambiguously means a 4-minute-13-second video. Cloud platforms such as AWS and Google Cloud sometimes adopt the same format for timeout and expiry settings, so if you spot this notation in a YAML config file or JSON response, running it through this tool to see the equivalent number of seconds can make the value much easier to picture.
At the same time, the standard has an interesting quirk: durations that include years or months don't have a fixed, absolute length. The same "P1Y" can represent 365 or 366 real-world days depending on whether it spans a leap year. Ultimately, this is exactly why this tool has to rely on an approximation whenever a conversion involves years or months.