{"uid":"cap_GzPwoIGp0UQIp5Xxgymhc","slug":"toolbelt402-time-math-f33eb8e0","name":"Toolbelt402 Time Math","description":"Date and time arithmetic done right: difference between two datetimes, add or subtract ISO-8601 durations, convert an instant into any IANA timezone with UTC offset and weekday.","url":"https://toolbelt402.tpoborne.workers.dev/time/math","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":["op"],"properties":{"op":{"enum":["diff","add","subtract","convert"],"type":"string","description":"diff needs from+to; add/subtract need start+duration (ISO-8601, e.g. P1DT2H30M); convert needs time+tz"},"to":{"type":"string"},"tz":{"type":"string","description":"IANA timezone, e.g. Europe/London"},"from":{"type":"string"},"time":{"type":"string"},"start":{"type":"string"},"duration":{"type":"string"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","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.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_rmn1v20jmVq8fp0cBskrI","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Performs date/time arithmetic: computes the difference between two datetimes, adds or subtracts ISO-8601 durations from a start time, or converts a timestamp to any IANA timezone with UTC offset and weekday.","exampleAgentPrompt":"How many days and hours are between 2024-03-15T09:00:00Z and 2024-11-28T17:30:00Z? Use the diff operation.","exampleUseCases":[{"title":"Meeting time across timezones","prompt":"Convert 2025-06-10T14:00:00Z to the America/Los_Angeles timezone so I know what time that meeting falls on for the West Coast team."},{"title":"Project deadline calculation","prompt":"What date and time do I land on if I add a duration of P2DT5H30M to a start time of 2025-07-01T08:00:00Z?"},{"title":"Elapsed time between two events","prompt":"How much time passed between 2024-01-15T08:30:00Z and 2024-09-22T17:45:00Z? Give me the diff in days, hours, and minutes."}],"resultDescription":"Returns a JSON object containing the result of the requested time operation: for 'diff', the duration between two datetimes (days, hours, minutes, seconds); for 'add'/'subtract', the resulting datetime after applying the ISO-8601 duration; for 'convert', the input instant expressed in the target IANA timezone including UTC offset and weekday name.","failureModes":["Missing required 'op' query parameter returns an error","Invalid or missing 'from'/'to' for diff operation returns a validation error","Malformed ISO-8601 duration string for add/subtract returns a parse error","Unrecognized IANA timezone string for convert operation returns an error","Missing 'time' or 'tz' parameter for convert operation returns an error"],"whenToPreferThis":"Choose this endpoint when you need precise, server-side date/time arithmetic without relying on client-side libraries — especially for ISO-8601 duration math, timezone-aware conversions with correct UTC offsets and DST handling, or computing exact differences between two timestamps. Prefer it over general-purpose code execution when you want a lightweight, deterministic, single-call result for time operations.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T18:49:01.849Z","isFirstParty":false}