Sunrise & Sunset
Sunrise, sunset and day length for any location.
GET
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
lat | number | Optional | Latitude coordinate |
lng | number | Optional | Longitude coordinate |
city | string | Optional | City name (alternative to lat/lng) |
country | string | Optional | ISO2 country code (use with city) |
date | string | Optional | Date in YYYY-MM-DD format (default: today) |
timezone | string | Optional | Override timezone for output times |
Provide either lat/lng or city/country.
Request Example
curl "https://api.localityapi.com/v1/sun?city=Dubai&country=AE&date=2026-06-02" \
-H "X-API-Key: lapi_your_key"Response
json
{
"sunrise": "05:29:20",
"sunrise_12h": "05:29 AM",
"sunset": "19:06:11",
"sunset_12h": "07:06 PM",
"day_length": "13h 36m",
"timezone": "Asia/Dubai",
"query_ms": 38
}Response Fields
sunrisestringSunrise time in 24-hour formatsunrise_12hstringSunrise time with AM/PMsunsetstringSunset time in 24-hour formatsunset_12hstringSunset time with AM/PMday_lengthstringDuration of daylighttimezonestringTimezone used for output timesquery_msintegerQuery execution time in milliseconds