Date Math v1.8.0
Date Math / Tools / date_range

Last month, this quarter or YTD as exact dates

Turn a reporting period into exact start and end dates and times in a time zone: "last month", "this quarter", "YTD", "MTD", "last 7 days", "next 2 weeks", "2026-Q3", "2026-W14". Optional comparison period (previous period, or same period last year), fiscal years starting in any month, and Monday, Sunday or Saturday week starts. Use for analytics queries, SQL date filters, reports and dashboards.

MCP tool date_rangeHTTP POST /v1/date_range25 free calls a day, then $0.001

Try it

Runs the real tool over MCP. Edit the arguments and run. Uses your daily free calls.

date_range
result
{
  "period": "last_month",
  "timezone": "America/New_York",
  "as_of": "2026-11-10",
  "label": "October 2026",
  "start_date": "2026-10-01",
  "end_date": "2026-10-31",
  "days": 31,
  "start": "2026-10-01T00:00:00-04:00",
  "end_exclusive": "2026-11-01T00:00:00-04:00",
  "start_utc": "2026-10-01T04:00:00Z",
  "end_exclusive_utc": "2026-11-01T04:00:00Z",
  "comparison": {
    "type": "previous_year",
    "method": "same dates one year earlier",
    "label": "October 2025",
    "start_date": "2025-10-01",
    "end_date": "2025-10-31",
    "days": 31,
    "start": "2025-10-01T00:00:00-04:00",
    "end_exclusive": "2025-11-01T00:00:00-04:00",
    "start_utc": "2025-10-01T04:00:00Z",
    "end_exclusive_utc": "2025-11-01T04:00:00Z"
  }
}

The result shown before you run is a saved example response.

Use it from your agent

Add the MCP server once and your agent can call date_range and the other 22 tools.

Claude Code

One command in your terminal.

claude mcp add --transport http date-math https://date-math.datemath.workers.dev/mcp

Any MCP client

Claude Desktop, Cursor, VS Code, Windsurf.

{
  "mcpServers": {
    "date-math": {
      "url": "https://date-math.datemath.workers.dev/mcp"
    }
  }
}

HTTP + x402

POST JSON; pay the 402 with any x402 client.

curl -X POST https://date-math.datemath.workers.dev/v1/date_range \
  -H "Content-Type: application/json" \
  -d '{"period":"last_month","timezone":"America/New_York","as_of":"2026-11-10","compare":"previous_year"}'

Full schema: OpenAPI · llms.txt

Questions

Common questions, answered with real results from the tool.

How do I get the exact start and end of last month in my time zone?

Send period last_month and a time zone. Asked on 2026-11-10 in America/New_York, it returns 2026-10-01T00:00:00-04:00 to 2026-11-01T00:00:00-04:00 (end exclusive), which is 2026-10-01T04:00:00Z in UTC. Filter with >= start and < end_exclusive so the last day is fully included.

Does "last 7 days" include today?

Not by default: it is the 7 complete days before today, so on 2026-11-10 it covers 2026-11-03 to 2026-11-09. Pass include_today: true to end the range today instead. Month-to-date and year-to-date include today by default.

Can it use a fiscal year that does not start in January?

Yes. Pass fiscal_year_start as a month number. With a July fiscal year, "this quarter" on 2026-11-10 is Q2 FY2027 (October to December 2026); fiscal years are named by the calendar year they end in.