杂项

转换时间戳 (旧版,推荐使用/convert/unixtime)

0次调用
免费接口

这是一个用于将Unix时间戳转换为人类可读日期时间的旧版接口。

GET
uapis.cn
/api/v1/misc/timestamp
查询参数
1
ts
string
required

需要转换的Unix时间戳,支持10位(秒)或13位(毫秒)。

功能概述

输入一个秒级或毫秒级的时间戳,返回其对应的本地时间和UTC时间。

注意

接口已过时:这个接口已被新的 /convert/unixtime 取代。新接口功能更强大,支持双向转换。我们建议你迁移到新接口。

➡️ 前往新版接口文档

查询参数

ts
string必填

需要转换的Unix时间戳,支持10位(秒)或13位(毫秒)。

响应

200 / 请求成功

转换成功!

JSON
{
  "datetime_local": "2023-01-01 08:00:00",
  "datetime_utc": "2023-01-01 00:00:00",
  "input": "1672531200",
  "type": "秒",
  "unix_timestamp": 1672531200
}

400 / 错误的请求

无效的时间戳参数。请检查 ts 参数是否为纯数字字符串。

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