Time/Timezone Utilities

End Of Period

Calculates the exact end timestamp for any time period — day, week, month, quarter, or year. Access via MCP in Cursor and other AI editors, or REST API at `/v1/time/end-of`. Pass a date and period type, get back the precise end moment (like 2024-03-31T23:59:59.999Z for March). Essential for date range queries and period-based calculations.

API Endpoint

GET /v1/time/end-of

Code Examples

curl "https://tinyfn.io/v1/time/end-of" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/time/end-of', {
  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/end-of',
    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

How do I get the end of the current month using the end-of-period tool?

Send a GET request to `/v1/time/end-of` with the current date and period='month'. Returns the last millisecond of the month as an ISO timestamp.

What time periods does the end-of-period function support?

Supports day, week, month, quarter, and year periods. Each returns the precise end timestamp down to milliseconds for accurate date range operations.

Can MCP agents use end-of-period for financial quarter calculations?

Yes, Claude Code and other MCP-enabled editors can call this tool with period='quarter' to get exact quarter-end dates for financial reporting and analysis.

Does end-of-period handle timezone conversions automatically?

The tool works with the input timezone context. Specify timezone in your date parameter or it defaults to UTC for consistent period boundary calculations.

What's the difference between end-of-day and end-of-week periods?

End-of-day returns 23:59:59.999 of the same date, while end-of-week finds the last millisecond of Sunday (or your locale's week-end day).

Try End Of Period Now

Get your free API key and start using End Of Period in seconds.

Get Free API Key