bilibili-API-collect/docs/misc/time_stamp.md

74 lines
1.2 KiB
Markdown
Raw Normal View History

2023-02-22 01:00:06 +08:00
# 获取当前时间戳
## 获取当前时间戳
> https://api.bilibili.com/x/report/click/now
*请求方式GET*
**json回复**
根对象:
| 字段 | 类型 | 内容 | 备注 |
| ------- | ---- | -------- | ------- |
| code | num | 返回值 | 0成功 |
| message | str | 错误信息 | 默认为0 |
| ttl | num | 1 | |
| data | obj | 信息本体 | |
`data`对象:
| 字段 | 类型 | 内容 | 备注 |
| ---- | ---- | ------------ | ---- |
| now | num | 当前的时间戳 | |
**示例:**
```shell
curl 'https://api.bilibili.com/x/report/click/now'
```
<details>
<summary>查看响应示例:</summary>
```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"now": 1592666471
}
}
```
</details>
## 获取服务器端UTC时间
> https://interface.bilibili.com/serverdate.js
*请求方式GET*
**js回复**
```js
window.serverdate = Date.UTC(YYYY, M, D, h, m, s);
```
**示例:**
```shell
curl 'https://interface.bilibili.com/serverdate.js'
```
<details>
<summary>查看响应示例:</summary>
```js
window.serverdate = Date.UTC(2021, 4, 16, 17, 31, 8);
```
</details>