Date Arithmetic API
GET /api/calc/dates $0.001 per call
USDC on Base · x402
Exact date arithmetic — the calendar math LLMs guess at. ?from=&to= → days, business days, weeks, hours between; ?date=&add=30d|2w|3m|1y|10bd → the resulting date (bd = business days); ?date= alone → weekday, ISO week, day-of-year, leap year, unix. All UTC, Mon-Fri business days, real-calendar validation (Feb 30 is rejected).
Parameters
| Name | In | Description | |
|---|---|---|---|
from | query | ISO date — with to: difference | |
to | query | ||
date | query | ISO date — alone: info; with add: arithmetic | |
add | query | e.g. 30d, -2w, 3m, 1y, 10bd |
Example request
curl "https://api.webbersites.com/api/calc/dates?from=2026-07-09&to=2026-12-25"
# first call returns 402 + payment requirements; an x402 client pays and retries automaticallyExample response
{
"from": {
"date": "2026-07-09",
"weekday": "Thursday"
},
"to": {
"date": "2026-12-25",
"weekday": "Friday"
},
"diff": {
"days": 169,
"business_days": 121,
"weeks": 24.14
}
}MCP tool: get_calc_dates — via npx -y webbersites-x402-mcp (local, key stays on your machine) or the remote endpoint https://api.webbersites.com/mcp.
How payment works
There is no signup and no API key. Call the endpoint; it replies 402 Payment Required with machine-readable payment requirements. Your client signs a USDC transfer authorization (EIP-3009, gasless) and retries with the X-PAYMENT header — @x402/fetch does this automatically. See the overview for a working snippet.