Epoch Converter API Documentation

Free REST API for Unix Timestamp Conversion

🚀 Quick Start

📌 Base URL

https://tools.dee4u.com/Epoch-Converter/api.php

✅ Example 1: Convert Epoch to Date

Convert Unix timestamp to date/time

curl "https://tools.dee4u.com/Epoch-Converter/api.php?endpoint=epoch-to-date&epoch=1735689600&timezone=Asia/Bangkok"

✅ Example 2: Convert Date to Epoch

Convert date/time to Unix timestamp

curl "https://tools.dee4u.com/Epoch-Converter/api.php?endpoint=date-to-epoch&date=2025-01-01%2000:00:00&timezone=UTC&interpret_as=utc"

✅ Example 3: Get Current Time

Get current time

curl "https://tools.dee4u.com/Epoch-Converter/api.php?endpoint=now&timezone=Asia/Bangkok"

GET POST 1. Epoch → Date/Time

Convert Unix timestamp (epoch) to human-readable date/time format.

Parameters

Parameter Type Required Description
endpoint string Required epoch-to-date or epoch2date
epoch integer Required Unix timestamp (seconds or milliseconds)
timezone string Optional Timezone e.g. UTC, Asia/Bangkok (default: UTC)
unit string Optional auto (default), seconds, or milliseconds

Response Example

{
  "success": true,
  "data": {
    "local": {
      "formatted": "2025-01-01 07:00:00",
      "iso8601": "2025-01-01T07:00:00+07:00",
      "rfc1123": "Wed, 01 Jan 2025 07:00:00 +07:00",
      "timezone": "Asia/Bangkok",
      "offset": "+07:00"
    },
    "utc": {
      "formatted": "2025-01-01 00:00:00",
      "iso8601": "2025-01-01T00:00:00+00:00",
      "rfc1123": "Wed, 01 Jan 2025 00:00:00 GMT",
      "timezone": "UTC",
      "offset": "+00:00"
    },
    "epoch": {
      "seconds": 1735689600,
      "milliseconds": 1735689600000
    },
    "relative": "in 0 days"
  },
  "meta": {
    "cached": false
  },
  "timestamp": "2025-01-15T10:30:00+00:00"
}

JavaScript Example

// แปลง Epoch เป็นวันเวลา
fetch('https://tools.dee4u.com/Epoch-Converter/api.php?endpoint=epoch-to-date&epoch=1735689600&timezone=Asia/Bangkok')
  .then(response => response.json())
  .then(data => {
    console.log('Local Time:', data.data.local.formatted);
    console.log('UTC Time:', data.data.utc.formatted);
    console.log('Epoch (seconds):', data.data.epoch.seconds);
  });

GET POST 2. Date/Time → Epoch

Convert human-readable date/time to Unix timestamp (epoch).

Parameters

Parameter Type Required Description
endpoint string Required date-to-epoch or date2epoch
date string Required Date/time string e.g. "2025-01-01 00:00:00"
timezone string Optional Timezone (used when interpret_as=local)
interpret_as string Optional utc (default) or local

JavaScript Example

// แปลงวันเวลาเป็น Epoch
const date = encodeURIComponent('2025-01-01 00:00:00');
fetch(`https://tools.dee4u.com/Epoch-Converter/api.php?endpoint=date-to-epoch&date=${date}&timezone=UTC&interpret_as=utc`)
  .then(response => response.json())
  .then(data => {
    console.log('Epoch (seconds):', data.data.epoch.seconds);
    console.log('Epoch (milliseconds):', data.data.epoch.milliseconds);
  });

GET 3. Current Time

Get current Unix timestamp and formatted date/time.

Parameters

Parameter Type Required Description
endpoint string Required now
timezone string Optional Timezone for formatting (default: UTC)

⚡ Rate Limiting

Usage Limit: 100 requests per hour per IP address

Rate limit information is included in response headers:

  • X-RateLimit-Limit: Maximum requests allowed
  • X-RateLimit-Remaining: Remaining requests
  • X-RateLimit-Reset: Time when rate limit resets (Unix timestamp)

When rate limit is exceeded, API returns 429 status code

💾 Caching

Caching System: API responses are cached for 1 hour

Identical requests within the cache period will return cached results

Check if response is cached: look at "cached" field in meta

❌ Error Handling

When an error occurs, API returns JSON response in this format:

{
  "success": false,
  "error": "Error message here",
  "details": {},
  "timestamp": "2025-01-15T10:30:00+00:00"
}

HTTP Status Codes:

  • 200 - Success
  • 400 - Bad Request (invalid parameters)
  • 405 - Method Not Allowed
  • 429 - Too Many Requests (rate limit exceeded)
  • 500 - Internal Server Error

📧 Support

For questions, issues, or feature requests, please contact:

hello@dee4u.com

← Back to Epoch Converter