Misc

Convert Timestamp (legacy — use /convert/unixtime instead)

0calls
Free

Legacy endpoint that converts a Unix timestamp into a human-readable date and time.

GET
uapis.cn
/api/v1/misc/timestamp
Query parameters
1
ts
string
required

The Unix timestamp to convert. Accepts 10 digits (seconds) or 13 digits (milliseconds).

Overview

Provide a second-level or millisecond-level Unix timestamp and the endpoint returns the corresponding local time and UTC time.

Warning

Deprecated: This endpoint has been superseded by /convert/unixtime, which is more powerful and supports two-way conversion. Please migrate to the new endpoint.

➡️ Go to the new endpoint

Query parameters

ts
stringrequired

The Unix timestamp to convert. Accepts 10 digits (seconds) or 13 digits (milliseconds).

Response

200 / OK

Conversion succeeded.

JSON
{
  "datetime_local": "2023-01-01 08:00:00",
  "datetime_utc": "2023-01-01 00:00:00",
  "input": "1672531200",
  // Detected unit of the input timestamp. Returned in Chinese: 秒 means seconds, 毫秒 means milliseconds.
  "type": "秒",
  "unix_timestamp": 1672531200
}

400 / Bad Request

Invalid timestamp parameter. Make sure ts is a numeric string.

JSON
{
  "code": "INVALID_ARGUMENT",
  "details": {},
  "message": "Invalid timestamp parameter."
}