Skip to content

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 NameTypeRequiredDescriptionExample
latitudeStringYesLatitude (cannot be empty)"39.9042"
longitudeStringYesLongitude (cannot be empty)"116.4074"
dateStringNoDate in yyyy-MM-dd format"2025-05-23"
timezoneStringNoTimezone identifier (e.g., UTC, Asia/Shanghai)"UTC"
timeFormatStringNoTime format: 12 (12-hour) or 24 (24-hour)"24"

Notes

  1. Required Fields: latitude and longitude must not be empty (validated via @NotBlank).

  2. 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.

  3. 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 NameTypeDescriptionExampleFormat Rules
dateStringQueried date"2025-05-23"yyyy-MM-dd
sunriseStringSunrise time (returns 12/24-hour format based on request)"5:42:55 AM"h:mm:ss a (12h) or HH:mm:ss (24h)
sunsetStringSunset time"7:02:21 PM"h:mm:ss a (12h) or HH:mm:ss (24h)
firstLightStringAstronomical dawn (sun 18° below horizon)"4:19:12 AM"h:mm:ss a (12h) or HH:mm:ss (24h)
lastLightStringAstronomical dusk (sun 18° below horizon)"8:26:04 PM"h:mm:ss a (12h) or HH:mm:ss (24h)
dawnStringCivil dawn (sun 6° below horizon, enough light for outdoor activities)"5:18:26 AM"h:mm:ss a (12h) or HH:mm:ss (24h)
duskStringCivil dusk (sun 6° below horizon, artificial lighting needed)"7:26:50 PM"h:mm:ss a (12h) or HH:mm:ss (24h)
solarNoonStringSolar noon (sun at its highest point)"12:22:38 PM"h:mm:ss a (12h) or HH:mm:ss (24h)
goldenHourStringGolden hour (~1 hour before sunset, ideal for photography)"6:30:36 PM"h:mm:ss a (12h) or HH:mm:ss (24h)
dayLengthStringTotal daylight duration (from sunrise to sunset)"13:19:25"HH:mm:ss (24-hour format)