Date/Time Utilities

Date To Timestamp

Converts human-readable dates into Unix timestamps for system integration and data processing. Use via MCP in Cursor or Windsurf, or call GET /v1/datetime/to-timestamp directly. Example: "2024-03-15 14:30:00" becomes 1710511800. Returns precise epoch seconds, handling timezone conversions and multiple date formats deterministically.

API Endpoint

GET /v1/datetime/to-timestamp

Code Examples

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

What date formats does the timestamp converter accept?

Accepts ISO 8601, RFC 3339, and common formats like YYYY-MM-DD HH:MM:SS. Also handles partial dates, automatically filling missing time components with zeros.

How do I convert dates to timestamps in my MCP-enabled editor?

In Cursor or Claude Code, reference the date-to-timestamp tool with your date string. The AI agent will call the MCP function and return the Unix timestamp immediately.

Does the converter handle timezones correctly?

Yes, it processes timezone indicators in the input date. If no timezone is specified, it defaults to UTC to ensure consistent, deterministic results across systems.

What's the difference between this and JavaScript's Date.getTime()?

This tool returns Unix timestamps in seconds (standard epoch format), while JavaScript returns milliseconds. It also handles edge cases and invalid dates more predictably.

Can I batch convert multiple dates to timestamps?

Each API call processes one date. For batch operations, make multiple requests or use the MCP tool repeatedly within your AI workflow for efficient processing.

Try Date To Timestamp Now

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

Get Free API Key