ISO 8601 Duration Converter
Enter an ISO 8601 duration to parse, or total seconds to format.
Result
How it is calculated
The tool works in two directions. Parse reads a string of the form P[n]D T[n]H[n]M[n]S (without the spaces), where each part is optional but at least one must be present, and the T separates days from the time part. Total seconds are days × 86400 + hours × 3600 + minutes × 60 + seconds. Format takes a number of seconds, drops any fraction, and splits it into days, hours, minutes and seconds to build the string; zero gives PT0S. Only whole numbers of D, H, M and S are accepted. Years, months, weeks (P1W), decimals (PT1.5S) and lowercase letters give no result. A day is always exactly 86,400 seconds.
Worked example
Parse the duration P1DT2H30M. The P opens the period, 1D is one day, the T switches to time, 2H is two hours and 30M is thirty minutes. Seconds: 1 × 86400 = 86,400, plus 2 × 3600 = 7,200, plus 30 × 60 = 1,800, which totals 95,400 s. The tool shows the readable form 1d 2h 30m. Going the other way, 95400 seconds in format mode returns P1DT2H30M.
Common mistakes
- Leaving out the
Tbefore the hours, soP2His rejected. Hours, minutes and seconds all need the T in front of them. - Writing weeks or months, such as
P2WorP3M. This tool only knows days, hours, minutes and seconds, so convert weeks to days first. - Using a decimal such as
PT0.5HorPT1.5S. Only whole numbers are read, so writePT30Minstead. - Confusing
M: after the T it means minutes. A month cannot be written here at all.
About this calculator
ISO 8601 is the international standard for writing dates, times, and durations so that computers everywhere parse them the same way. Its duration format packs years, months, weeks, days, hours, minutes, and seconds into one string that opens with P (for “period”) and inserts a T before any time-of-day components — so P1DT2H30M reads as 1 day, 2 hours, 30 minutes, with no locale-dependent word order to trip up a parser.
This exact notation is what XML Schema’s xs:duration type stores, what iCalendar (RFC 5545) uses for event durations, and what REST APIs from AWS, Google Calendar, and Stripe return for elapsed-time fields; language libraries like Java’s Duration/Period classes and Python’s isodate module read and write it natively. Converting a duration string to total seconds means summing each designator’s value times its unit (days×86400, hours×3600, minutes×60, seconds×1); going the other way means peeling seconds off in the same order and re-assembling the P/T string — which is exactly what this converter automates, along with a human-readable breakdown. It works with days, hours, minutes, and whole seconds only: durations containing years, months, weeks (such as P1W or P1Y2M), or fractional seconds are not accepted, so convert those to days first.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments (1)
Durations here are pure clock time, a day always being 86,400 seconds, which is why weeks, months and years are refused: their length varies. That also means P1D is not the same thing as 24 hours in a calendar across a daylight-saving change. Note that 129600 seconds formats as P1DT12H, while PT36H parses to 129,600 s as well. Which API gave you a duration string you could not read at first?