# Date Math: Add/Subtract Calendar & Business Days

> Date Math: Add/Subtract Calendar & Business Days is a paid API for AI agents from date-math.datemath.workers.dev, paid per call via x402, $0.001/call, status unknown (last checked 2026-11-21).

Adds or subtracts years, months, weeks, days, business days, hours, minutes, and seconds from a given date/datetime, with month-end clamping and business-day logic that skips weekends, custom holidays, and country-specific public holidays.

## Facts

- Endpoint: POST https://date-math.datemath.workers.dev/v1/add?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-21
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/date-math-add-subtract-calendar-business-days-bba464a5
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_u4DwmQp62wAG-QvbbAUol

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 date-math-add-subtract-calendar-business-days-bba464a5 -d '<json body>'
```

Example prompt: What date is 30 business days after November 7, 2026, skipping US public holidays? Give me the result date and whether it falls on a business day.

## When to prefer this

Use this endpoint when you need to compute a future or past date by adding or subtracting any combination of calendar units (years, months, weeks, days) or business days from a known start date, especially when you need to respect country-specific public holidays or custom holiday calendars. Prefer it over generic date libraries when business-day logic with international public holidays (207 countries) is required, or when month-end clamping semantics are important (e.g. Jan 31 + 1 month = Feb 28).

## Known failure modes

- Invalid or unparseable date string returns an error response
- Country code not matching ISO 3166-1 alpha-2 causes holiday lookup failure
- Holidays array exceeding 1000 items rejected
- Workdays array with no items or values outside 0–6 rejected
- Requesting dates outside 2000–2050 range may not have full public holiday coverage
- Missing required 'date' field causes validation error

## How this service works

Date Math: Add or subtract years/months/weeks/days/business days/hours/minutes/seconds from a date. Month-end clamping; business days skip weekends, given holidays, and the public holidays of an optional country. Use for due dates, deadlines, delivery estimates, expiry and "N working days from today".

## Output

A JSON object containing the computed result date or datetime (ISO 8601), the original input date, the weekday name of the result, and a boolean indicating whether the result is a business day.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "date": {
   "type": "string",
   "example": "2026-11-07T14:30:00Z",
   "description": "YYYY-MM-DD, or ISO 8601 datetime with Z or offset"
  },
  "days": {
   "type": "integer"
  },
  "hours": {
   "type": "integer"
  },
  "weeks": {
   "type": "integer"
  },
  "years": {
   "type": "integer"
  },
  "months": {
   "type": "integer"
  },
  "country": {
   "type": "string",
   "example": "US",
   "pattern": "^[A-Za-z]{2}$",
   "description": "ISO 3166-1 alpha-2 country code (207 countries); its public holidays (2000–2050) are excluded from business days"
  },
  "minutes": {
   "type": "integer"
  },
  "seconds": {
   "type": "integer"
  },
  "holidays": {
   "type": "array",
   "items": {
    "type": "string",
    "example": "2026-11-07",
    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
   },
   "maxItems": 1000,
   "description": "Extra dates excluded from business-day counts (rest days from workdays are always excluded)"
  },
  "workdays": {
   "type": "array",
   "items": {
    "type": "integer",
    "maximum": 6,
    "minimum": 0
   },
   "example": [
    1,
    2,
    3,
    4,
    5
   ],
   "maxItems": 7,
   "minItems": 1,
   "description": "Working days of the week, 0 = Sunday. Default [1,2,3,4,5] (Mon–Fri); e.g. [0,1,2,3,4] for Sun–Thu or [1,2,3,4,5,6] for Mon–Sat"
  },
  "business_days": {
   "type": "integer",
   "description": "Applied after calendar units; skips rest days (see workdays) and holidays"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "input": "2026-12-22",
  "result": "2026-12-31",
  "weekday": "Thursday",
  "is_business_day": true
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/date-math-add-subtract-calendar-business-days-bba464a5/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from date-math.datemath.workers.dev](https://www.zero.xyz/host/date-math.datemath.workers.dev/llms.txt)
