Time/Timezone Utilities

Get Quarter

Extracts the fiscal quarter (1-4) from any date input. Call via MCP in Cursor or Windsurf, or hit GET /v1/time/quarter with your date. Returns clean integer output like `{"quarter": 2}` for April dates. Handles various date formats and timezone considerations automatically.

API Endpoint

GET /v1/time/quarter

Code Examples

curl "https://tinyfn.io/v1/time/quarter" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/time/quarter', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/time/quarter',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's time/timezone tools:

{
  "mcpServers": {
    "tinyfn-time": {
      "url": "https://tinyfn.io/mcp/time",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

What date formats does the quarter extraction tool accept?

Accepts ISO 8601 (2024-04-15), Unix timestamps, and common formats like MM/DD/YYYY. Always assumes standard calendar quarters unless specified otherwise.

How can I get quarters for multiple dates using MCP in Claude Code?

Call the quarter tool repeatedly in your MCP session, or batch process dates in your application code using the REST endpoint for better performance.

Does this use fiscal year quarters or calendar year quarters?

Returns standard calendar quarters by default: Q1 (Jan-Mar), Q2 (Apr-Jun), Q3 (Jul-Sep), Q4 (Oct-Dec). Fiscal year quarters require different calculation logic.

What happens with edge case dates like leap years or timezone boundaries?

Handles leap years correctly and processes dates in UTC unless timezone is specified. Month boundaries determine quarter assignment regardless of specific day.

Can I integrate quarter data into financial reporting workflows?

Yes, the clean integer output (1-4) integrates easily with spreadsheets, databases, and reporting tools. Combine with other time utilities for comprehensive date processing.

Try Get Quarter Now

Get your free API key and start using Get Quarter in seconds.

Get Free API Key