Calculate exact days in any month, handling leap years automatically. Use via MCP in AI coding tools or REST API at `/v1/time/days-in-month`. Pass year and month (1-12) to get precise counts — February 2024 returns 29, February 2023 returns 28. Essential for date calculations and calendar logic.
curl "https://tinyfn.io/v1/time/days-in-month" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/time/days-in-month', {
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/days-in-month',
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"
}
}
}
}
Call the days-in-month tool with year and month parameters. For example, year=2024, month=2 returns 29 days for February in a leap year.
Yes, it automatically calculates leap years including century rules. February 2000 returns 29 days, but February 1900 returns 28 days.
Use numeric values 1-12 where 1=January, 2=February, etc. String month names are not supported.
Yes, it works for any valid year. Useful for AI agents calculating date ranges, scheduling logic, or historical data analysis.
Invalid months (0, 13+) will return an error. Always validate month is between 1-12 before calling.
Get your free API key and start using Days In Month in seconds.
Get Free API Key