GET
实用工具
时间戳转换
时间戳与日期互转,支持时区;也支持毫秒时间戳。
累计调用 11
今日调用 0
更新于 2026-10-16
调用地址
GET
https://itapi.top/api/timestamp
请求参数
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| ts | string | 可选 | 时间戳,留空取当前时间 | 暂无 |
| format | string | 可选 | 日期格式 | 暂无 |
| timezone | string | 可选 | 时区 | 暂无 |
返回字段
| 字段名 | 类型 | 说明 |
|---|---|---|
| code | int | 状态码 |
| data.datetime | string | 格式化时间 |
| data.timestamp | int | 秒级时间戳 |
| data.iso | string | ISO 8601 |
响应示例
200 OK
{"code":200,"msg":"success","data":{"now":"2026-10-16 19:55:36","timestamp":1792151736,"timestamp_ms":1792151736000,"timezone":"Asia\/Shanghai"}}
在线测试
代码示例
cURL · GET
curl "https://itapi.top/api/timestamp?ts=%E6%9A%82%E6%97%A0&format=%E6%9A%82%E6%97%A0&timezone=%E6%9A%82%E6%97%A0"
PHP
<?php
$res = file_get_contents("https://itapi.top/api/timestamp?ts=%E6%9A%82%E6%97%A0&format=%E6%9A%82%E6%97%A0&timezone=%E6%9A%82%E6%97%A0");
$json = json_decode($res, true);
print_r($json);
JavaScript
const res = await fetch("https://itapi.top/api/timestamp?ts=%E6%9A%82%E6%97%A0&format=%E6%9A%82%E6%97%A0&timezone=%E6%9A%82%E6%97%A0");
const json = await res.json();
console.log(json);
Python
import requests
r = requests.get("https://itapi.top/api/timestamp?ts=%E6%9A%82%E6%97%A0&format=%E6%9A%82%E6%97%A0&timezone=%E6%9A%82%E6%97%A0", timeout=10)
print(r.json())