{"uid":"cap_u4DwmQp62wAG-QvbbAUol","slug":"date-math-add-subtract-calendar-business-days-bba464a5","name":"Date Math: Add/Subtract Calendar & Business Days","description":"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\".","url":"https://date-math.datemath.workers.dev/v1/add?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"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"}}},"responseSchema":{"type":"json","example":{"input":"2026-12-22","result":"2026-12-31","weekday":"Thursday","is_business_day":true}},"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_csiF6ZgWGF3LjAY-HXRB2","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":"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.","exampleAgentPrompt":"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.","exampleUseCases":[{"title":"Contract deadline calculation","prompt":"Our contract starts on March 1, 2027 — what is the exact date 90 calendar days later, and is that a business day? We're in the US so skip US public holidays."},{"title":"Invoice payment due date","prompt":"I need to send a payment due date that's 30 business days after January 15, 2027, skipping weekends and UK public holidays. What date does that land on?"},{"title":"Project sprint end date","prompt":"Our sprint kicks off on Monday February 2, 2026. What date is exactly 10 business days later, using a Mon–Fri workweek and skipping 2026-02-16 as a company holiday?"}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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).","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-21T12:33:57.149Z","isFirstParty":false,"canonicalSlug":"date-math-add-subtract-calendar-business-days-bba464a5"}