Time/Timezone Utilities

Week Number

Converts any date to its ISO 8601 week number (1-53), where week 1 contains January 4th. Use via MCP in Cursor or Claude Code for scheduling logic, or call GET /v1/time/week-number with date parameters. Returns deterministic week calculations following the ISO standard where weeks start on Monday.

API Endpoint

GET /v1/time/week-number

Code Examples

curl "https://tinyfn.io/v1/time/week-number" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/time/week-number', {
  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/week-number',
    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 is ISO 8601 week numbering and how does it work?

ISO 8601 defines week 1 as the first week containing January 4th, with weeks starting on Monday. This means some January dates belong to the previous year's last week, and some December dates belong to the next year's first week.

How do I get the week number for today's date using MCP?

Call the week-number tool in your MCP-enabled editor like Cursor or Windsurf without parameters to get the current week, or pass a specific date string to get that date's week number.

What happens with edge cases like January 1st or December 31st?

January 1st might return week 52 or 53 of the previous year if it falls before the first Thursday. December 31st might return week 1 of the next year if it's in the first ISO week.

What date formats does the week number API accept?

The API accepts ISO 8601 date strings (YYYY-MM-DD), Unix timestamps, and other common date formats. Invalid dates return an error with format requirements.

How is this different from regular calendar week numbering?

Unlike simple calendar weeks that always start with January 1st as week 1, ISO week numbering ensures each week has exactly 7 days and maintains consistency across years for business and scheduling applications.

Try Week Number Now

Get your free API key and start using Week Number in seconds.

Get Free API Key