https://xxyh.xiaoli.icu/api/p_sunrise_sunset.phphttps://xxyh.xiaoli.icu/api/p_sunrise_sunset.php?city=%E5%8C%97%E4%BA%AC&tz=8基于 NOAA 太阳位置算法计算指定日期、指定地点的日出、日落、太阳正午、昼长与民用晨昏蒙影时间。
可传 city(内置 48 个国内外主要城市)或 lat/lon 自定义坐标,tz 为时区偏移(默认 8,即北京时间)。算法误差通常在 1 分钟内;极昼极夜区域会明确返回说明而不是错误时间。纯本地计算,不联网。
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
city |
string | 选填 | 北京 | 城市名,如 北京/上海/东京 |
lat |
string | 选填 | — | 纬度,与 lon 同时传则优先于 city |
lon |
string | 选填 | — | 经度 |
date |
string | 选填 | — | 日期 YYYY-MM-DD,默认今天 |
tz |
int | 选填 | 8 | 时区偏移,默认 8 |
https://xxyh.xiaoli.icu/api/p_sunrise_sunset.php
此处将显示接口返回结果…
{
"code": 200,
"msg": "ok",
"data": {
"city": "北京",
"date": "2026-11-28",
"sunrise": "07:12",
"sunset": "16:52",
"solar_noon": "12:02",
"day_length": "9 小时 40 分",
"civil_dawn": "06:43",
"civil_dusk": "17:21"
}
}
—