Date and time

Duration converterOne duration, several ways to read it

Enter one duration per line. Two-part clock input means hours:minutes; bare numbers use the selected input unit.

duration converter

Input

Your input is processed in this browser and is not sent to a server.

Results

Options

One value per line: PT1H30M, 01:30 (= 1h 30m), 1h 30m, or 90.5. Short units: w d h m/min s ms.

Fixed day = 24 hours; week = 7 days. P1M (month) is rejected; PT1M (minute) is accepted.

Exact whole milliseconds only. Use a decimal dot; target values may be rounded to 9 decimals.

Maximum: 1000 lines, 100000 UTF-16 code units, 512 per line; ±10^18 ms per duration. Empty lines are errors.

Enter input or choose an example to begin.

Use the duration converter when an API returns PT1H30M but a timeout setting expects seconds. Compare that value with a spreadsheet entry such as 1.5 hours without treating either as a date.

A batch can mix ISO strings, clock notation and short units. The report keeps each original line next to its answer, so a malformed entry does not shift the remaining results out of alignment.

Why use this duration converter?

Compare equivalent formats

The duration converter gives PT1H30M, 01:30 and 1h 30m the same 5400-second value. Each result also includes exact milliseconds and a human readable duration in total-hour notation, making a unit mismatch easier to spot.

Three different time representations converge on one clock and a shared measurement strip.

Keep calendar uncertainty visible

A month has no single fixed length in seconds. A line containing P1M is rejected while PT1M becomes 60 seconds. Valid lines continue through the batch, so one calendar quantity cannot silently become a guessed number.

Fixed clock units pass to a measurement strip while a calendar is stopped at a separate boundary.

Resolve the ambiguous parts first

01

Read the colon before choosing units

01:30 always means one hour and thirty minutes. For one minute and thirty seconds, use 00:01:30 or 1m 30s. The input-unit selector only affects numbers without a suffix.

02

Decide when results should update

Automatic conversion waits 350 ms after editing. Turn it off to inspect a batch before running, then use the Convert button or Ctrl/Cmd + Enter. Changing any option makes the previous report stale immediately.

03

Check the row count and precision

Invalid and empty lines remain in the report. Read the error at its original line, and check any rounded marker against the exact millisecond total. Show more adds 50 rows; both exports contain the entire batch.

Several representations, one exact value

ISO input and normalized output

Accept standalone whole weeks such as P2W or an ordered day/time form such as P1DT2H3M4.005S. The output balances fixed days, hours, minutes and seconds; zero becomes PT0S.

Convert time to seconds or another unit

Choose milliseconds, seconds, minutes, hours, 24-hour days or 7-day weeks. For hours to minutes, select hours for a bare value such as 1.5 and minutes as the target; the answer is 90.

Signed decimal arithmetic

A leading minus applies to the entire expression: -1h 30m is negative ninety minutes. Decimal unit input is accepted only when it maps exactly to integer milliseconds, so 0.1s is preserved without binary floating-point noise.

Mixed batches with traceable failures

Each nonempty value is parsed independently. The report shows the original text, target value, exact milliseconds, ISO string and total-hour clock form. Invalid rows retain their position and explanation instead of becoming zero.

The limits behind the numbers

Fixed days, no calendar arithmetic
A day is exactly 86400 seconds and a week is seven such days. Years and months, even explicitly written as zero, are rejected. Dates, timezones, daylight saving and leap seconds are outside this calculation.
An explicit ISO subset
Use uppercase P and T; whole weeks must stand alone, and days, hours and minutes must be integers. Only seconds may have up to three fractional digits. Intervals, repeated intervals and mixed ISO weeks/days are not accepted.
Short units and unambiguous clocks
Unit tokens are w, d, h, m or min, s and ms, each at most once in any order. Words such as hours and localized unit names are not input syntax. Clock minutes and seconds need two digits from 00 to 59; hours do not wrap at 24.
Precision is limited openly
Use a dot as the decimal separator. Numeric and short-unit quantities allow up to nine fractional digits but must resolve to whole milliseconds. Target values are rounded to nine decimals when needed, with ties away from zero; exact milliseconds and the two duration strings remain unrounded.
Bounded batches, no implicit totals
At most 1000 physical lines, 100000 UTF-16 code units in total and 512 per line; each duration is at most ±10^18 ms. Blank lines are errors. Rows are not added, sorted or deduplicated. File import, URL fetching and shared-input links are not provided.

Duration converter questions

Which duration notations can I enter?

Enter an ISO 8601 duration from the supported subset, H:MM or H:MM:SS.fff, short units such as 2h 5m, or a decimal number. A plain number uses the selected input unit, which starts at seconds. Different forms may share one batch.

Are decimal durations supported?

Yes. For example, 1.5 hours is 5400000 milliseconds. Numeric input supports up to nine decimal places when the value is an exact whole number of milliseconds. ISO and clock seconds allow up to three; finer input is rejected rather than truncated.

How are negative time spans handled?

Place one minus sign before the complete duration, as in -PT1H or -1h 30m. Individual signed components are not accepted. Negative zero is normalized to zero. This sign support is an extension of the documented ISO subset.

Why can a year produce different second totals?

Calendar years and months depend on the starting date. This tool does not substitute an average: P1Y and P1M produce errors. Use a date calculation with an actual start and end if you need elapsed time across a calendar period.

Can the result be written as an ISO duration?

Yes. Every successful row includes a normalized ISO string alongside the target value. For instance, 90061 seconds becomes P1DT1H1M1S. The total-hour form is also shown as 25:01:01 so days do not hide elapsed hours.

Unexpected result?

Convert the next duration

Try the duration converter with the mixed example, then replace it with your own values. Review ambiguous clock notation and rounded values before using a result in a timeout or report.