DevToolsmith

Duration Converter

Convert timeout, TTL and elapsed-time values between fixed units. Parse ISO durations such as PT1H30M and preserve nanosecond precision.

Runs 100% in your browser — nothing is uploaded

Days are exactly 24 hours. Months and years need a calendar date. Decimal results marked ≈ are truncated to 12 places.

ISO duration
PT5400S
ns
5400000000000
us
5400000000
ms
5400000
s
5400
min
90
h
1.5
d
0.0625
w
≈0.008928571428

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.

InputInput unitMillisecondsNanosecondsNormalized ISO
PT1H30Miso54000005400000000000PT5400S
P2Diso172800000172800000000000PT172800S
0.000000001s0.0000011PT0.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.