# Duration parser and formatter

Turn a duration such as "1h 30m", "PT1H30M" or "1:30:00" into seconds, ISO 8601 and plain words.

- Endpoint: `POST https://setget.net/v1/tools/duration-parse` with JSON `{"input": {...}}`
- MCP: `run_tool` with `slug` = `duration-parse`
- Page: https://setget.net/tools/duration-parse

## Inputs

- `value` (required, string): A duration in words, ISO 8601 or clock form, or a number of seconds to format.

## Example 1

```json
{"input":{"value":"1h 30m"}}
```

Result:

```json
{"seconds":5400,"milliseconds":5400000,"iso":"PT1H30M","human":"1 hour and 30 minutes","clock":"1:30:00","parts":{"days":0,"hours":1,"minutes":30,"seconds":0}}
```

## Example 2: Seconds back to a readable duration

```json
{"input":{"value":"187200"}}
```

Result:

```json
{"seconds":187200,"milliseconds":187200000,"iso":"P2DT4H","human":"2 days and 4 hours","clock":"52:00:00","parts":{"days":2,"hours":4,"minutes":0,"seconds":0}}
```

**Is 1:30 an hour and a half or a minute and a half?** Two parts are read as minutes:seconds, so 1:30 is 90 seconds. Write 1:30:00 for an hour and a half.

**Why are months and years rejected?** They vary in length (28 to 31 days, 365 or 366 days), so they have no exact number of seconds. Use date-add or date-diff when the calendar matters.

**How precise is it?** To the millisecond. Smaller fractions are rounded.
