API Example
js
-- 请求地址
https://www.tc03vd.top/timeInfo/getSunTimeInfo
-- 请求参数
{
"latitude": "22.553290",
"longitude": "113.883080"
}
-- 响应结果
{
"code": 0,
"msg": "ok",
"data": {
"date": "2025-05-23",
"sunrise": "5:42:55 AM",
"sunset": "7:02:21 PM",
"firstLight": "4:19:12 AM",
"lastLight": "8:26:04 PM",
"dawn": "5:18:26 AM",
"dusk": "7:26:50 PM",
"solarNoon": "12:22:38 PM",
"goldenHour": "6:30:36 PM",
"dayLength": "13:19:25"
},
"ok": true,
"success": true
}Request URL
https://www.tc03vd.top/timeInfo/getSunTimeInfo
Request Method
POST
Request Parameters
json
{
"latitude": "39.9042",
"longitude": "116.4074",
"date": "2025-05-23",
"timezone": "Asia/Shanghai",
"timeFormat": "12"
}Field Descriptions
| Field Name | Type | Required | Description | Example |
|---|---|---|---|---|
| latitude | String | Yes | Latitude (cannot be empty) | "39.9042" |
| longitude | String | Yes | Longitude (cannot be empty) | "116.4074" |
| date | String | No | Date in yyyy-MM-dd format | "2025-05-23" |
| timezone | String | No | Timezone identifier (e.g., UTC, Asia/Shanghai) | "UTC" |
| timeFormat | String | No | Time format: 12 (12-hour) or 24 (24-hour) | "24" |
Notes
Required Fields: latitude and longitude must not be empty (validated via @NotBlank).
Default Values:
If date is not provided, the current date is used.
If timezone is not provided, the system timezone is used.
If timeFormat is not provided, the default is 24-hour format.
Time Format:
timeFormat=12 → Returns "5:42:55 AM"
timeFormat=24 → Returns "05:42:55"
Response
json
{
"code": 0,
"msg": "ok",
"data": {
"date": "2025-05-23",
"sunrise": "5:42:55 AM",
"sunset": "7:02:21 PM",
"firstLight": "4:19:12 AM",
"lastLight": "8:26:04 PM",
"dawn": "5:18:26 AM",
"dusk": "7:26:50 PM",
"solarNoon": "12:22:38 PM",
"goldenHour": "6:30:36 PM",
"dayLength": "13:19:25"
},
"ok": true,
"success": true
}Field Descriptions
| Field Name | Type | Description | Example | Format Rules |
|---|---|---|---|---|
| date | String | Queried date | "2025-05-23" | yyyy-MM-dd |
| sunrise | String | Sunrise time (returns 12/24-hour format based on request) | "5:42:55 AM" | h:mm:ss a (12h) or HH:mm:ss (24h) |
| sunset | String | Sunset time | "7:02:21 PM" | h:mm:ss a (12h) or HH:mm:ss (24h) |
| firstLight | String | Astronomical dawn (sun 18° below horizon) | "4:19:12 AM" | h:mm:ss a (12h) or HH:mm:ss (24h) |
| lastLight | String | Astronomical dusk (sun 18° below horizon) | "8:26:04 PM" | h:mm:ss a (12h) or HH:mm:ss (24h) |
| dawn | String | Civil dawn (sun 6° below horizon, enough light for outdoor activities) | "5:18:26 AM" | h:mm:ss a (12h) or HH:mm:ss (24h) |
| dusk | String | Civil dusk (sun 6° below horizon, artificial lighting needed) | "7:26:50 PM" | h:mm:ss a (12h) or HH:mm:ss (24h) |
| solarNoon | String | Solar noon (sun at its highest point) | "12:22:38 PM" | h:mm:ss a (12h) or HH:mm:ss (24h) |
| goldenHour | String | Golden hour (~1 hour before sunset, ideal for photography) | "6:30:36 PM" | h:mm:ss a (12h) or HH:mm:ss (24h) |
| dayLength | String | Total daylight duration (from sunrise to sunset) | "13:19:25" | HH:mm:ss (24-hour format) |
