Time/Timezone Utilities

Datetime To Unix

Converts human-readable datetime strings to Unix timestamps (seconds since January 1, 1970 UTC). Access via MCP in Cursor or Windsurf, or REST at `/v1/time/datetime-to-unix`. Pass "2024-03-15 14:30:00" and get back 1710509400. Handles ISO 8601 formats and timezone conversions accurately.

API Endpoint

GET /v1/time/datetime-to-unix

Code Examples

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

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

Learn more about MCP setup →

FAQ

What datetime formats does the Unix timestamp converter accept?

Supports ISO 8601 formats like '2024-03-15T14:30:00Z', '2024-03-15 14:30:00', and variations with timezone offsets (+05:00, -08:00).

How do I convert datetime to Unix timestamp using MCP in Claude Code?

Call the datetime-to-unix tool with your datetime string as the parameter. The MCP integration handles the conversion and returns the numeric timestamp.

Does the converter handle different timezones correctly?

Yes, it processes timezone information in the input string. If no timezone is specified, it assumes UTC by default.

What's the difference between Unix timestamp and epoch time?

They're the same thing — both represent seconds elapsed since January 1, 1970, 00:00:00 UTC (the Unix epoch).

Can I convert future dates or does it only work for past timestamps?

Works for any valid date, past or future. Unix timestamps can represent dates well into the future (until 2038 for 32-bit systems, much longer for 64-bit).

Try Datetime To Unix Now

Get your free API key and start using Datetime To Unix in seconds.

Get Free API Key