This tool converts a length of time into an ISO 8601 duration string, the international standard format for representing durations in software and data. While most people write a duration as something like one and a half hours, computers need an unambiguous, language-independent format, and ISO 8601 provides it. A duration is written starting with the letter P, for period, followed by the number of days, then a T separating the date part from the time part, then hours, minutes and seconds, each tagged with a letter. So one hour and thirty minutes becomes PT1H30M, and one day, two hours and thirty minutes becomes P1DT2H30M. This format appears throughout modern systems: in APIs and web services, in databases, in scheduling and calendar data, in video and media metadata, and in programming languages that parse durations. This tool builds the string for you. You enter the days, hours, minutes and seconds, and the calculator assembles the correct ISO 8601 duration string, and also gives the total in seconds and minutes and a plain-language summary for reference. The results update as you type. Use it to produce a duration for an API request, to encode a time span in data, to learn the ISO 8601 format, or to check a duration you have been given. The standard is precise about the order and the letters: the T must appear before any hours, minutes or seconds, which is what distinguishes minutes, tagged M after the T, from months, also tagged M but before the T. Because this tool deals with days down to seconds, every M it produces is minutes, sitting after the T, so there is no ambiguity. The total seconds figure is handy when a system wants a raw count rather than the formatted string.
ISO 8601: P[days]DT[hours]H[minutes]M[seconds]S. The T separates date from time, so M after T is minutes. Total seconds is handy for raw counts.
The calculator assembles the ISO 8601 string by writing P, then the days followed by D if any, then a T if there is any time component, then the hours, minutes and seconds each followed by their letter. It also multiplies each unit to a total in seconds, the days by 86,400, hours by 3,600 and minutes by 60, and adds them.
Entering 1 day, 2 hours, 30 minutes and 0 seconds produces the ISO 8601 string P1DT2H30M. The total in seconds is 1 times 86,400, plus 2 times 3,600, plus 30 times 60, which is 86,400 plus 7,200 plus 1,800, equals 95,400 seconds, or 1,590 minutes.
If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.
Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.
All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.
Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.
Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.
Calculate.co.nz is hosted in Auckland via SiteHost new Zealand.
All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.
© 2019 to 2026 Calculate.co.nz. All rights reserved.