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.
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)
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"
}
}
}
}
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.
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.
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.
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.
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.