# ISO 8601 Duration String Formatter

> ISO 8601 Duration String Formatter is a paid API for AI agents from datetime.openverbs.com, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-15).

Assembles a valid ISO 8601 duration string (e.g. P1Y2M10DT2H30M) from individual numeric components (years, months, weeks, days, hours, minutes, seconds) and an optional sign.

## Facts

- Endpoint: POST https://datetime.openverbs.com/v1/format
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/iso-8601-duration-string-formatter-5ea61208
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_OafTX53Qmtwk_a3o514M4

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability iso-8601-duration-string-formatter-5ea61208 -d '<json body>'
```

Example prompt: Build me an ISO 8601 duration string for 1 year, 2 months, 10 days, 2 hours, and 30 minutes.

## When to prefer this

Choose this endpoint when you have individual numeric time components (years, months, weeks, days, hours, minutes, seconds) and need to produce a standards-compliant ISO 8601 duration string. Prefer it over manual string concatenation to avoid formatting errors, especially when dealing with optional components or negative durations. It complements the sibling parse endpoint when you need round-trip duration handling.

## Known failure modes

- All components are zero — at least one must be non-zero
- Negative component values provided — all components must be non-negative
- Invalid sign value — must be 1 or -1
- Missing required body fields — request rejected with validation error
- Malformed JSON body — parse error returned

## How this service works

Assemble an ISO 8601 duration string from individual components (years, months, weeks, days, hours, minutes, seconds) and an optional sign. All components must be non-negative and at least one must be non-zero.

## Output

Returns a valid ISO 8601 duration string (e.g. 'P1Y2M10DT2H30M') constructed from the supplied component values, respecting the overall sign (positive or negative). The string can be used directly in calendar APIs, scheduling systems, or any standard ISO 8601 duration-aware service.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "type": "object",
     "properties": {
      "days": {
       "type": "number",
       "minimum": 0,
       "description": "Days."
      },
      "sign": {
       "enum": [
        1,
        -1
       ],
       "type": "integer",
       "description": "Overall sign. Default 1."
      },
      "hours": {
       "type": "number",
       "minimum": 0,
       "description": "Hours."
      },
      "weeks": {
       "type": "number",
       "minimum": 0,
       "description": "Weeks."
      },
      "years": {
       "type": "number",
       "minimum": 0,
       "description": "Years."
      },
      "months": {
       "type": "number",
       "minimum": 0,
       "description": "Months."
      },
      "minutes": {
       "type": "number",
       "minimum": 0,
       "description": "Minutes."
      },
      "seconds": {
       "type": "number",
       "minimum": 0,
       "description": "Seconds."
      }
     },
     "additionalProperties": false
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST"
     ],
     "type": "string"
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/iso-8601-duration-string-formatter-5ea61208/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from datetime.openverbs.com](https://www.zero.xyz/host/datetime.openverbs.com/llms.txt)
