{"uid":"cap_8vUcKMNw9YlqUu1B-xmCO","slug":"x402-utils-date-arithmetic-difference-calculator-cd16019c","name":"x402 Utils – Date Arithmetic & Difference Calculator","description":"Add or subtract an ISO 8601 duration (P1M, P2W, PT36H) to a date, months clamped to the month's end; or count the days, weeks, calendar months, years, seconds and business days (Monday to Friday, less a country's public holidays) between two dates. Also the weekday, ISO week and day of year.","url":"https://qcb7fnxsbd7fbhj4.68r.lambda-web.us-east-1.on.aws/v1/date?utm_source=zero.xyz","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":["start"],"properties":{"add":{"type":"string","description":"an ISO 8601 duration to add, such as P1M10D"},"end":{"type":"string","description":"a second date, to count the time between"},"start":{"type":"string","description":"a date such as 2026-10-25, or an ISO 8601 time"},"country":{"type":"string","description":"ISO country code whose public holidays are not business days, such as JP"},"subtract":{"type":"string","description":"an ISO 8601 duration to subtract"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"start":{},"between":{}}}}}}},"responseSchema":{"type":"json","example":{"start":{"date":"2026-10-25","weekday":"Sunday","iso_week":43},"between":{"days":61,"months":2,"business_days":42}}},"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_AAT8nIzziZO8fZKpmpcJ8","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":"Add or subtract an ISO 8601 duration to/from a date, or compute the difference between two dates in days, weeks, months, years, seconds, and business days (with country-specific public holidays).","exampleAgentPrompt":"What date is exactly 3 months from 2026-10-25, and how many business days are between 2026-10-25 and that resulting date, excluding Japanese public holidays?","exampleUseCases":[{"title":"Contract deadline extension calculator","prompt":"I signed a contract on 2025-03-15 with a 6-month term (P6M). What date does it end, and what day of the week is that?"},{"title":"Sprint duration in business days","prompt":"How many business days are there between 2025-09-01 and 2025-09-30 in the UK, excluding British public holidays?"},{"title":"Age in days and weeks","prompt":"How many days, weeks, and full calendar years are between 1990-06-14 and today, 2025-07-10?"}],"resultDescription":"A JSON object with a 'start' section containing the date, weekday, ISO week number, and day of year; and optionally a 'between' section with the difference expressed in days, weeks, months, years, seconds, and business days (adjusted for country-specific public holidays when a country code is supplied).","failureModes":["Missing 'start' parameter returns a 400-level error","Malformed ISO 8601 duration (e.g. 'P1month' instead of 'P1M') may return an error or unexpected result","Invalid country code may result in no holiday adjustment or an error","Providing neither 'end' nor 'add'/'subtract' returns only start-date metadata without difference or arithmetic","Dates outside supported range may produce inaccurate results"],"whenToPreferThis":"Choose this endpoint when you need precise calendar arithmetic — adding or subtracting ISO 8601 durations (with correct month-end clamping), computing multi-unit differences between two dates, or getting business-day counts that respect a specific country's public holidays. It is preferable over general-purpose code execution or LLM reasoning for date math because it handles edge cases like month-end clamping, ISO week numbers, and country-specific holiday calendars out of the box.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-30T12:30:38.583Z","isFirstParty":false,"canonicalSlug":"x402-utils-date-arithmetic-difference-calculator-cd16019c"}