| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
action |
string | 必填 | convert |
操作类型:convert(时区转换,默认)/ now(查询一个或多个时区当前时间)/ list(列出可用时区)/ diff(计算两地时差)/ offset(查询 UTC 偏移与夏令时状态) |
timezone |
string | 选填 | - | 源时区,IANA 名称(如 Asia/Shanghai)或常见城市别名(如 Beijing/北京/Tokyo/伦敦),多个用英文逗号分隔。action=now/offset 必填,action=list 选填 |
to_timezone |
string | 选填 | - | 目标时区,格式同 timezone,支持英文逗号分隔多目标。action=convert/diff 时必填 |
datetime |
string | 选填 | - | 待转换时间,支持 YYYY-MM-DD HH:MM:SS(按 timezone 解释)或 ISO8601 带偏移(如 2026-10-31T09:30:00+08:00,以字符串内偏移为准)。action=convert/diff 时与 timestamp 二选一 |
timestamp |
int | 选填 | - | Unix 秒级时间戳,与 datetime 二选一;同时传入时以 timestamp 优先 |
format |
string | 选填 | %Y-%m-%d %H:%M:%S |
输出时间格式,支持 strftime 语法,长度上限 64,仅允许字母数字、常见分隔符与中文 |
utc_offset |
boolean | 选填 | True |
是否在每个结果项中返回 UTC 偏移(utc_offset / offset_seconds),默认 true |
dst_flag |
boolean | 选填 | True |
是否在每个结果项中返回夏令时状态(is_dst),默认 true |
keyword |
string | 选填 | - | 时区搜索关键词,仅 action=list 使用,按 IANA 名称模糊匹配,如 China / America |
limit |
int | 选填 | 100 |
返回条数,默认 100,上限 594,仅 action=list 生效 |
| 字段名 | 类型 | 说明 |
|---|---|---|
code | int | 状态码,0=成功 |
desc | string | 状态描述 |
data− |
object | 业务数据(成功时返回) |
results− |
array | 时区结果数组(convert / now / diff / offset 返回,多时区逐项) |
timezone |
string | IANA 时区名,如 Asia/Shanghai |
alias |
string | 请求中使用的原始写法,便于对照 |
datetime |
string | 转换后的完整时间 |
date |
string | 日期 YYYY-MM-DD |
time |
string | 时间 HH:MM:SS |
weekday |
string | 星期,中文(周一…周日) |
is_dst |
boolean | 是否处于夏令时(dst_flag=true 时返回) |
utc_offset |
string | UTC 偏移,如 +08:00(utc_offset=true 时返回) |
offset_seconds |
int | UTC 偏移秒数(utc_offset=true 时返回) |
tzname |
string | 时区缩写,如 CST / EDT |
timestamp |
int | 对应的 Unix 秒级时间戳 |
diff_hours |
float | 两地时差(小时),正数表示 to_timezone 比 timezone 早,仅 action=diff 返回 |
note |
string | 夏令时切换或输入解析提示,仅在需要时返回 |
zones− |
array | 时区列表,仅 action=list 返回 |
timezone |
string | IANA 时区名 |
utc_offset |
string | 当前 UTC 偏移,如 +08:00 |
tzname |
string | 时区缩写 |
region |
string | 所属大洲/区域,如 Asia / America |
total |
int | 命中或返回条目总数(list 为命中时区总数,其余为结果项数) |
keyword |
string | list 操作回显的搜索关键词,仅 action=list 返回 |
request_id | string | 请求追踪ID |
{
"code": 0,
"desc": "success",
"data": { ... },
"request_id": "abc123..."
}
{
"code": 999,
"desc": "错误描述",
"request_id": "abc123..."
}
© 网程科技(林州网程科技有限公司) | 豫ICP备2025120409号-2 | 豫B2-20230220 | 豫公网安备 41058102000262号