Date/Time Utilities

Format Date

Transform date strings into any format you need. Send a date and format pattern to GET /v1/datetime/format to get consistently formatted output. Perfect for standardizing timestamps in logs, APIs, or user interfaces. Uses standard format tokens like YYYY-MM-DD, ensuring your MCP-enabled AI tools handle dates correctly every time.

API Endpoint

GET /v1/datetime/format

Code Examples

curl "https://tinyfn.io/v1/datetime/format" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/datetime/format', {
  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/format',
    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 date/time tools:

{
  "mcpServers": {
    "tinyfn-datetime": {
      "url": "https://tinyfn.io/mcp/datetime",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I format a date string with TinyFn's format date tool?

Send your date string and desired format pattern to GET /v1/datetime/format. For example, format '2024-01-15' as 'MM/DD/YYYY' to get '01/15/2024'.

What date format patterns does TinyFn's date formatter support?

Standard tokens like YYYY (4-digit year), MM (2-digit month), DD (2-digit day), HH (24-hour), mm (minutes), ss (seconds). Combine with separators like /, -, or spaces.

Can I use TinyFn's date formatter in MCP tools like Cursor or Claude?

Yes, it's available as an MCP tool in Cursor, Claude Code, GitHub Copilot, Windsurf, Cline, OpenClaw, and Zed for consistent date formatting in your AI workflows.

What happens if I send an invalid date to the format endpoint?

The tool returns an error response if the input date string cannot be parsed. Always validate your date inputs or handle potential parsing failures.

How is TinyFn's date formatter different from JavaScript's Date.toLocaleDateString?

TinyFn provides deterministic, server-side formatting that's consistent across environments, while JavaScript methods can vary by browser locale and timezone settings.

Try Format Date Now

Get your free API key and start using Format Date in seconds.

Get Free API Key