---
title: "Add/subtract a duration from a date, or compute the diff between two dates"
method: POST
path: "/date-math.php"
tags: ["datetime"]
---

# Add/subtract a duration from a date, or compute the diff between two dates

`POST /date-math.php`

## Request

- Base URL: `https://mate.tools/api/v1`
- URL: `https://mate.tools/api/v1/date-math.php`
- Auth: none declared

Two modes: (1) provide `start` + `add` (e.g. '+90 days', '-2 weeks', 'next friday') to compute the resulting date, OR (2) provide `start` + `end` to compute the diff. Diff mode optionally counts business days only (Mon-Fri). Times are in UTC.

## Request body

- object
  - `start` string, required
  - `add` string
  - `end` string
  - `business_days` boolean

## Response `200`

Success

## Other responses

- `400`: Malformed request
- `429`: Rate limit exceeded (60/min, 600/hour per IP). Includes Retry-After header.

---

[API](https://skmtc.dev/mate/apis/mate-tools-api.md) · [All operations](https://skmtc.dev/mate/apis/mate-tools-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mate/apis/mate-tools-api/revisions/874670b78962?raw)
