ISO 8601 Duration Calculator NZ

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.

Calculate.co.nz is proud to be partnered with Health Based Building, a leader in sustainable and health-conscious building innovation. With over a century of experience, they develop high-performance systems like Foreverbreathe Specification, Magnum Board, and Foreverbreathe Paints to support energy-efficient, non-toxic living environments. Their commitment to healthier homes aligns with our belief that informed choices lead to better outcomes for Kiwi households.
Calculate.co.nz partner: Health Based Building
Advertise on this page
P1DT2H30M
ISO 8601 duration
Total seconds95,400 s
Total minutes1,590 min
Plain language1d 2h 30m 0s

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.

How it works

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.

Worked example

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.

Related calculators