Reporting period to exact dates
date_rangeConvert natural-language periods like last month, YTD, or 2026-Q3 into exact start/end dates and times in a time zone for analytics, SQL filters, and reports.
Instructions
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. First 25 calls per day are free, then $0.001 per call (x402).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"period": "<period>"
},
"name": "date_range"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| as_of | No | Reference date for relative periods: YYYY-MM-DD, or a datetime (its local date is used). Default: today in timezone | |
| period | Yes | Relative: today, yesterday, tomorrow, this_/last_/next_ + week|month|quarter|half|year, week_to_date|month_to_date|quarter_to_date|year_to_date (or wtd, mtd, qtd, ytd), last_N_days|weeks|months|quarters|years, next_N_days|weeks|months|... Spaces work too ("last 7 days"). last_N_days = N complete days before today; last_N_months = N complete calendar months before this one. Explicit: 2026, 2026-H1, 2026-Q3 or "Q3 2026", 2026-03, 2026-W14 (ISO week), 2026-03-15 | |
| compare | No | Also return a comparison range. previous_period: the same length immediately before (to-date periods: the same number of days into the previous unit). previous_year: the same dates a year earlier (weeks: 52 weeks earlier, same weekdays) | |
| timezone | No | IANA time zone, e.g. America/New_York (default UTC) | |
| week_start | No | First day of the week. monday = ISO weeks (labels like 2026-W46) | monday |
| include_today | No | End the range with today (inclusive). Default true for *_to_date periods, false for last_N_* periods (complete days only) | |
| fiscal_year_start | No | Month the fiscal year starts (1 = January). Quarters, halves and years follow it; fiscal years are named by the calendar year they end in (start 7: FY2027 = July 2026 – June 2027) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | Yes | ||
| as_of | Yes | The local date that relative periods were resolved against | |
| label | Yes | e.g. "October 2026", "Q3 2026", "2026-W46", "FY2027", or "start to end" | |
| start | Yes | Local start, ISO 8601 with offset (local midnight) | |
| period | Yes | ||
| end_date | Yes | Last day, inclusive (YYYY-MM-DD) | |
| timezone | Yes | ||
| start_utc | Yes | ||
| comparison | No | ||
| start_date | Yes | First day (YYYY-MM-DD) | |
| week_start | No | ||
| end_exclusive | Yes | Local end, exclusive: the midnight after end_date. Filter with >= start and < end_exclusive | |
| end_exclusive_utc | Yes | ||
| fiscal_year_start | No | Month name, when not January |