Converts any date to its day-of-year number (1-366). Access via MCP in Cursor or Windsurf for AI agent date calculations, or call GET /v1/datetime/day-of-year directly. Input "2024-07-15" returns 197. Handles leap years automatically — February 29th becomes day 60, shifting all subsequent days forward by one.
curl "https://tinyfn.io/v1/datetime/day-of-year" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/datetime/day-of-year', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/datetime/day-of-year',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's date/time tools:
{
"mcpServers": {
"tinyfn-datetime": {
"url": "https://tinyfn.io/mcp/datetime",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Send a GET request to /v1/datetime/day-of-year with your date parameter, or use the MCP tool in supported AI editors. Returns an integer from 1-366.
Yes, it automatically accounts for leap years. In leap years, February 29th is day 60, and all dates after February get shifted up by one day number.
Accepts standard ISO date formats like YYYY-MM-DD. For example, '2024-12-31' returns 366 in a leap year, 365 in a regular year.
Absolutely. AI agents in Cursor or Claude Code can calculate date spans, seasonal patterns, or fiscal year positions using deterministic day-of-year values.
Day of year counts from January 1st (1-366), while day of week cycles through Monday-Sunday. Day 100 might be a Tuesday, depending on the year.