Time/Timezone Utilities

Start Of Period

Calculates the exact start of any time period (day, week, month, year, etc.) from a given timestamp. Access via MCP in Cursor or Windsurf, or REST at GET /v1/time/start-of. Perfect for AI agents building scheduling logic or analytics that need precise period boundaries. Returns ISO timestamps with millisecond accuracy.

API Endpoint

GET /v1/time/start-of

Code Examples

curl "https://tinyfn.io/v1/time/start-of" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/time/start-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/start-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 start of the current week using this tool?

Pass the current timestamp with period='week' parameter. Returns Monday 00:00:00 in the specified timezone (defaults to UTC).

What time periods are supported by the start-of endpoint?

Supports day, week, month, quarter, year, hour, and minute periods. Week starts are configurable (Monday vs Sunday).

Can MCP agents use this for financial quarter calculations?

Yes, set period='quarter' to get Q1 (Jan 1), Q2 (Apr 1), Q3 (Jul 1), or Q4 (Oct 1) start dates. Handles fiscal year offsets too.

Does the tool handle timezone conversions for period boundaries?

Yes, specify timezone parameter (e.g., 'America/New_York'). Period boundaries adjust to local time, not just UTC offsets.

What's the difference between start-of-day and truncating to midnight?

Start-of-day respects timezone rules including DST transitions, while simple truncation can miss hour shifts during clock changes.

Try Start Of Period Now

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

Get Free API Key