Paste an ISO 8601 duration such as PT1H30M or P3Y6M4DT12H30M5S to see it in plain words, total seconds, h:mm:ss and days, or go the other way and build a valid duration string from numbers or a number of seconds.
Enter seconds (95400, 3600.5) or a clock duration (26:30:00, 1:02:03:04 for d:h:m:s).
Years and months have no fixed length. Pick a start date for an exact answer.
Enter your values to see the result.
Advertisement
Advertisement
How to use the ISO 8601 Duration Converter
Choose a mode: parse an ISO string, build one from parts, or convert seconds and h:m:s.
Enter the duration, for example PT1H30M, or fill in the number fields.
Pick how years and months count: average lengths, 365/30 days, or exactly from a start date.
Read the results: words, total seconds, h:mm:ss, normalised and seconds-only ISO forms.
Copy the results or download the component breakdown as CSV.
The ISO 8601 duration format
An ISO 8601 duration describes a length of time, not a moment. Its general form is PnYnMnWnDTnHnMnS: the letter P (period) starts the string, date units follow, then T introduces the time units. Any unit that is zero can be left out, but at least one must remain, and units always appear in this order.
Designator
Meaning
Example
Equals
P
Start of the duration (required)
P1D
1 day
Y
Years
P2Y
2 years
M (before T)
Months
P6M
6 months
W
Weeks
P2W
14 days
D
Days
P10D
10 days
T
Start of the time part (required before H, M, S)
PT45M
45 minutes
H
Hours
PT8H
8 hours
M (after T)
Minutes
PT90M
1 hour 30 minutes
S
Seconds, decimals allowed
PT0.5S
500 milliseconds
An alternative format writes the same values in date-and-time style with fixed widths: P0003-06-04T12:30:05 means 3 years, 6 months, 4 days, 12 hours, 30 minutes and 5 seconds.
Converting to seconds
For the time part the arithmetic is exact: seconds = H × 3,600 + M × 60 + S, plus 86,400 per day and 604,800 per week. For example, P1DT2H30M = 86,400 + 7,200 + 1,800 = 95,400 seconds, which is 26:30:00 as hours, minutes and seconds.
Years and months are calendar units, so their length depends on when they start. Adding P1M to January 31 gives February 28 or 29, while adding it to March 1 gives April 1. Most libraries clamp to the last valid day of the month, which is what the exact mode here does. When no date is involved, the average Gregorian year (365.2425 days) is the most neutral choice.
Common durations
Duration
ISO 8601
Seconds
30 seconds
PT30S
30
15 minutes
PT15M
900
1 hour 30 minutes
PT1H30M
5,400
1 day
P1D (or PT24H)
86,400
1 week
P1W (or P7D)
604,800
30 days
P30D
2,592,000
1 year (365 days)
P365D
31,536,000
Prefer days and time units for exact lengths. Write P30D rather than P1M when you mean exactly thirty days, for instance for a token lifetime or a retention period.
PT0S is the zero duration. A bare P or PT is invalid.
Watch out for weeks. Older parsers reject P1W2D; P9D is safest.
Frequently asked questions
What does PT1H30M mean?
It is an ISO 8601 duration of 1 hour and 30 minutes. P marks a period, T separates the date part from the time part, and each number is followed by its unit: H for hours, M for minutes and S for seconds. It equals 5,400 seconds.
Why is M used for both months and minutes?
Position decides. An M before the T means months (P2M is two months), and an M after the T means minutes (PT2M is two minutes). P2MT2M is two months and two minutes.
How many seconds is P1D?
86,400 seconds in normal time arithmetic. On a calendar, one day can be 23 or 25 hours across a daylight-saving change, which is why some libraries keep days separate from hours.
How many seconds are in a month or a year in ISO 8601?
ISO 8601 does not fix them, because months have 28 to 31 days and years 365 or 366. This converter uses the average Gregorian year of 365.2425 days (month = 30.436875 days) by default, or 365 and 30 days, or counts exactly from a start date you choose.
Can an ISO 8601 duration be negative?
Not in the core ISO 8601-1 standard. A leading minus sign, as in -P1D or -PT30M, is an extension used by XML Schema, Java and several other systems, and this tool accepts it with a note.
Can I use decimals, like PT1.5H?
Yes, ISO 8601 allows a decimal fraction (with a dot or comma) on the smallest unit, so PT1.5H, PT0.25S and P0.5D are valid. Putting a fraction on a larger unit followed by more units, like PT1.5H30M, is not allowed.
Where are ISO 8601 durations used?
In video and API metadata (for example video lengths such as PT4M13S), schema.org fields like cookTime and duration, XML Schema xs:duration, calendar recurrence rules, Java and .NET time libraries, and configuration files for timeouts and retention periods.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.