
Unix Timestamp Converter API
Development
Convert between human-readable dates and Unix timestamps instantly. Supports both seconds and milliseconds formats for developers and system administrators.
Authentication
All API requests require a valid API key passed in the Authorization header as a Bearer token.
Rate Limit
120 requests per minute
Endpoints
2 endpoints available
Overview
Converts a date and time to a Unix timestamp, or a Unix timestamp to a date. Send exactly one of
datetime or timestamp. Both GET (query string) and POST (JSON) work.
datetime to timestamp
- Accepted formats are ISO 8601:
2024-12-25,2024-12-25T15:30,2024-12-25 15:30:00,2024-12-25T15:30:00.123Zand2024-12-25T15:30:00-05:00. - A value with no Z or offset is read as UTC. The web tool reads it in your browser's time zone; the API does not depend on a time zone. Add an offset if you mean local time.
- Other free-form date text (such as "Dec 25, 2024") is not accepted by the API.
- A date that does not exist, such as 2024-02-30, returns a 400.
timestamp to date
- The unit is detected like the web tool does: 10 digits is seconds, 13 digits is milliseconds, other values below 10,000,000,000 are seconds, values from 1,000,000,000,000,000 up are microseconds, and anything else is milliseconds.
detectedUnittells you which was used. - Negative timestamps (dates before 1970) are accepted.
- Send it as a string or a whole number. Values outside the range JavaScript dates can hold (about 275,000 years either side of 1970) return a 400.
Endpoints
POST
https://opentools.ca/api/v1/tools/unix-timestamp-converterConvert a date to a timestamp, or a timestamp to a date
Request Body
Content-Type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
| datetime | string | Optional | ISO 8601 date or date and time to convert. Send this or timestamp, not both. |
| timestamp | string | number | Optional | Whole-number Unix timestamp in seconds, milliseconds or microseconds. Send this or datetime, not both. |
Response Example
{
"success": true,
"input": "1703517000000",
"detectedUnit": "milliseconds",
"iso": "2023-12-25T15:10:00.000Z",
"utc": "Mon, 25 Dec 2023 15:10:00 GMT",
"milliseconds": 1703517000000,
"seconds": 1703517000
}Error Codes
400
Bad Request - Both or neither of datetime and timestamp, a datetime that is not valid ISO 8601, or a timestamp out of range401
Unauthorized - Invalid or missing API key403
Forbidden - API key is inactive or expired, or the request IP is not allowed for this key429
Too Many Requests - Rate limit exceeded500
Internal Server ErrorGET
https://opentools.ca/api/v1/tools/unix-timestamp-converterConvert a date to a timestamp, or a timestamp to a date (query string)
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| datetime | string | Optional | ISO 8601 date or date and time. Send this or timestamp, not both. URL-encode it, especially a "+" offset. |
| timestamp | string | Optional | Whole-number Unix timestamp. Send this or datetime, not both. |
Response Example
{
"success": true,
"input": "2024-12-25T15:30:00Z",
"iso": "2024-12-25T15:30:00.000Z",
"milliseconds": 1735140600000,
"seconds": 1735140600
}Error Codes
400
Bad Request - Both or neither of datetime and timestamp, a datetime that is not valid ISO 8601, or a timestamp out of range401
Unauthorized - Invalid or missing API key403
Forbidden - API key is inactive or expired, or the request IP is not allowed for this key429
Too Many Requests - Rate limit exceeded500
Internal Server ErrorCode Examples
# Timestamp to date
curl -X POST https://opentools.ca/api/v1/tools/unix-timestamp-converter \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"timestamp": "1703517000"}'
# Date to timestamp
curl -G https://opentools.ca/api/v1/tools/unix-timestamp-converter \
-H "Authorization: Bearer YOUR_API_KEY" \
--data-urlencode "datetime=2024-12-25T15:30:00Z"Rather use it in your browser? Open the Unix Timestamp Converter