Duration parser and formatter
Turn a duration such as "1h 30m", "PT1H30M" or "1:30:00" into seconds, ISO 8601 and plain words.
Input
Result
Fill in the input and press Run.
Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.
Use it from code or an agent
curl -s https://setget.net/v1/tools/duration-parse \
-H 'Content-Type: application/json' \
-d '{"input":{"value":"1h 30m"}}'
import json, urllib.request
body = {'input': {'value': '1h 30m'}}
request = urllib.request.Request("https://setget.net/v1/tools/duration-parse", json.dumps(body).encode(),
{"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/duration-parse", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({"input":{"value":"1h 30m"}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
"slug": "duration-parse",
"input": {
"value": "1h 30m"
}
}
{
"input": {
"value": "1h 30m"
}
}
Endpoint: POST /v1/tools/duration-parse. Over MCP: run_tool with slug: "duration-parse".
Machine-readable: input schema, Markdown. Connect an agent.
Inputs
| Name | Type | Required | What it does |
|---|---|---|---|
value |
string | yes | A duration in words, ISO 8601 or clock form, or a number of seconds to format. |
Examples
Input
{
"value": "1h 30m"
}Result
{
"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
}
}Seconds back to a readable duration
Input
{
"value": "187200"
}Result
{
"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
}
}Questions
- 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.
Related tools
- Add or subtract time from a dateAdd or subtract years, months, weeks, days, hours and minutes from a date and get the resulting date.
date-add - Date difference calculatorFind the time between two dates: total days, weeks, hours, minutes and seconds, plus years, months and days.
date-diff - Unit converterConvert between units of length, mass, temperature, area, volume, speed, time, data, pressure, energy and more.
unit-convert - Age calculatorWork out an exact age in years, months and days on a given date, plus the next birthday.
age-calculator - Aspect ratio calculatorSimplify a width and height to a ratio such as 16:9, and scale to a new width or height.
aspect-ratio - Business days calculatorCount the working days between two dates, or add working days to a date, skipping weekends and holidays.
business-days