Read an ISO duration
PT1H30M means one hour and thirty minutes: 5400 seconds or 5400000 milliseconds. P2D means two fixed 24-hour days in this tool. Fractional seconds can contain up to nine digits.
Convert without large-number rounding
Integer arithmetic preserves very large durations and sub-millisecond values. Negative durations are supported. Inputs are bounded to keep processing responsive, and exponent notation is intentionally excluded.
Timeout and precision examples
Select the input unit before entering a decimal, or select ISO duration for a value starting with P. The output below is generated with the actual converter. Its normalized ISO output always uses seconds, even when the input uses hours or days.
| Input | Input unit | Milliseconds | Nanoseconds | Normalized ISO |
|---|---|---|---|---|
PT1H30M | iso | 5400000 | 5400000000000 | PT5400S |
P2D | iso | 172800000 | 172800000000000 | PT172800S |
0.000000001 | s | 0.000001 | 1 | PT0.000000001S |
Why P1M is different from PT1M
PT1M is one fixed minute. P1M is one calendar month and is rejected here because months have different lengths. Similarly, a local calendar day across a daylight-saving change may span 23 or 25 elapsed hours, whereas this converter’s day is always 24 hours.
Use Date Calculator to add months to a known date, Time Zone Converter for named-zone instants, or Unix Timestamp Converter for points in time. Values smaller than one nanosecond are rejected rather than rounded to zero.
Documentation examples checked: . How these tools are checked.
Frequently asked questions
Why are months and years not accepted?
Their length depends on a calendar date. This tool handles fixed weeks, 24-hour days, hours, minutes and seconds. Use Date Calculator to add calendar months or years to a specific date.
Are decimal conversions exact?
The internal value is an exact integer count of nanoseconds. Inputs below one nanosecond are rejected. Non-terminating output fractions are truncated to 12 decimal places and marked with an approximation sign; nanoseconds and the emitted seconds-based ISO duration stay exact.
Sources
Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.