Catalog/datetime-precise-duration

Date & Time

Precise duration between times API

Breaks the span between two ISO datetimes into calendar years/months/days plus hours/minutes/seconds (with borrow), and emits an ISO-8601 duration string and unit totals. Answers 'Exact duration between two timestamps?', 'How many years, months and days apart are these?'.

Price$0.04per request
MethodPOST
Route/v1/datetime/precise-duration
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
datetimedurationbetweenpreciseiso-8601years-months-daysintervalelapsed
API URLhttps://x402.hexl.dev/v1/datetime/precise-duration
Integration docs
Example request
{
  "from": "2024-01-15T10:00:00Z",
  "to": "2026-06-04T12:30:45Z"
}
Example response
{
  "from": "2024-01-15T10:00:00.000Z",
  "to": "2026-06-04T12:30:45.000Z",
  "sign": "positive",
  "years": 2,
  "months": 4,
  "days": 20,
  "hours": 2,
  "minutes": 30,
  "seconds": 45,
  "totalDays": 871.105,
  "totalHours": 20906.513,
  "totalSeconds": 75263445,
  "iso8601": "P2Y4M20DT2H30M45S",
  "interpretation": "2y 4mo 20d 2h 30m 45s between the two timestamps (ISO P2Y4M20DT2H30M45S)."
}
Input schema
{
  "type": "object",
  "required": [
    "from",
    "to"
  ],
  "properties": {
    "from": {
      "type": "string",
      "examples": [
        "2024-01-15T10:00:00Z"
      ]
    },
    "to": {
      "type": "string",
      "examples": [
        "2026-06-04T12:30:45Z"
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}