"How many days between March 1 and April 15?" Your agent says 44. It's actually 45. Date math is deceptively hard — leap years, varying month lengths, and edge cases trip up LLMs constantly. These tools handle date calculations correctly.
All DateTime Tools (16)
Your agent gets access to 16 datetime tools via the /mcp/datetime/ endpoint. Here's the complete list:
| Tool | Description |
|---|---|
datetime/now | Get Now |
datetime/timestamp | Convert Timestamp |
datetime/timestamp-ms | Convert Timestamp Ms |
datetime/to-timestamp | Date To Timestamp |
datetime/format | Format Date |
datetime/parse | Parse Date |
datetime/add | Add Time |
datetime/subtract | Subtract Time |
datetime/diff | Date Diff |
datetime/is-leap-year | Is Leap Year |
datetime/days-in-month | Days In Month |
datetime/week-number | Week Number |
datetime/day-of-year | Day Of Year |
datetime/is-weekend | Is Weekend |
datetime/age | Calculate Age |
datetime/relative | Relative Time |
Agent Scenarios
Here's how real agents use these tools:
1. Project management agent
A PM agent calculates deadline dates by adding business days to a start date. datetime/add-days handles month boundaries correctly.
datetime/add-days
{ "date": "2026-02-15", "days": 30 }
2. Contract review agent
A legal agent calculates the exact number of days remaining in a contract term. datetime/difference returns precise day counts.
datetime/difference
{ "date1": "2026-02-15", "date2": "2026-12-31" }
3. Scheduling agent
A calendar agent determines what day of the week a future date falls on. datetime/day-of-week eliminates guessing.
datetime/day-of-week
{ "date": "2026-12-25" }
MCP Setup
Add datetime tools to your agent in under 2 minutes. Choose your client:
Claude Desktop / Claude Code
Add this to your MCP config:
{
"mcpServers": {
"tinyfn-datetime": {
"url": "https://api.tinyfn.io/mcp/datetime/",
"headers": {
"X-API-Key": "your-api-key"
}
}
}
}
Cursor
Go to Settings > MCP and add a new server:
- Type: SSE
- URL:
https://api.tinyfn.io/mcp/datetime/sse - Headers:
X-API-Key: your-api-key
Tip: Use the category-specific endpoint (/mcp/datetime/) for the best experience. The all-in-one endpoint (/mcp/all/) works too but has 500+ tools which some clients handle less efficiently.
When to Use These Tools
Use datetime MCP tools when your agent needs to:
- Guarantee correctness — when wrong answers have real consequences
- Process user data — when you're operating on actual user input, not hypothetical examples
- Maintain consistency — when the same input must always produce the same output
You don't need these tools for casual conversation or rough estimates. Use them when precision matters.
Ready to add datetime tools to your agent?
Get Free API Key 100 requests/month free. No credit card required.Frequently Asked Questions
Why do LLMs struggle with date math?
Date calculations involve irregular month lengths, leap years, timezone offsets, and daylight saving time. LLMs attempt to reason through these rules but frequently make off-by-one errors or forget edge cases.
What date operations does TinyFn support?
TinyFn provides date parsing, formatting, difference calculation, add/subtract days, day of week, leap year checking, age calculation, and more.
What date formats are supported?
TinyFn accepts ISO 8601 dates (YYYY-MM-DD), Unix timestamps, and common date string formats. Results are returned in ISO format for consistency.