{"uid":"cap_e5zrSdDtn7xXmyzW77dkZ","slug":"duration-format-parse-75b771cf","name":"Duration Format & Parse","description":"Turn seconds into a readable duration (2 h 5 min) or parse one like '1d 3h 20m' back into seconds, minutes and hours.","url":"https://units-convert.x402tookit.com/duration-format?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":[],"properties":{"text":{"type":"string","description":"Duration text to parse, e.g. 1d 3h 20m or 90 minutes"},"seconds":{"type":"number","description":"Seconds to format (give this or text)"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"days":{"type":["null","number"]},"clock":{"type":["null","string"]},"hours":{"type":["null","number"]},"human":{"type":["null","string"]},"source":{"type":["null","string"]},"minutes":{"type":["null","number"]},"reasons":{"type":["array","null"]},"seconds":{"type":["null","number"]},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_ijKOJwVDG3xAkwWucukBh","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Formats a number of seconds into a human-readable duration string or parses a duration text like '1d 3h 20m' back into numeric components (seconds, minutes, hours, days).","exampleAgentPrompt":"How long is 7565 seconds in a human-readable format like hours and minutes? Also give me the breakdown in days, hours, minutes, and seconds.","exampleUseCases":[{"title":"Displaying elapsed job runtime","prompt":"I have a background job that took 9823 seconds to finish — can you turn that into a readable duration like '2h 43m 43s' so I can show it in the dashboard?"},{"title":"Parsing user-entered duration to seconds","prompt":"A user typed '1d 3h 20m' into a form field — can you parse that into a total number of seconds and also give me the breakdown in hours and minutes?"},{"title":"Formatting a countdown timer","prompt":"I have 86400 seconds left on a countdown — what does that look like in plain English, like '1 day' or '1d 0h 0m'?"}],"resultDescription":"Returns a structured object with the duration expressed as a human-readable string (e.g. '2 h 5 min'), a clock format, and numeric breakdowns for days, hours, minutes, and seconds. Also includes a summary field and source echo.","failureModes":["Missing both 'seconds' and 'text' query params — returns an error or empty result","Invalid duration text format that cannot be parsed — may return null component values","Negative seconds value — behavior undefined","Non-numeric input for 'seconds' param — likely returns an error"],"whenToPreferThis":"Use this endpoint when you need to convert a raw number of seconds into a display-friendly duration string, or when you need to parse a human-entered duration expression (like '1d 3h 20m') into numeric components. Prefer this over manual string formatting when you need consistent, multi-unit breakdowns (days/hours/minutes/seconds) and a ready-to-display human string without writing your own parsing logic.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-21T07:20:23.249Z","isFirstParty":false,"canonicalSlug":"duration-format-parse-75b771cf"}