Sunrise and Sunset

Platform: API iOS Android

Get the sunrise and sunset times for any location around the world for the next 60 days.

Interface Code Interface Class
getSun Sunrise and sunset data SunBean

Parameter

  • location(required)The location to be queried, support LocationID or comma-separated longitude and latitude (decimal, up to 2 decimal places), LocationID can be obtained by GeoAPI. Example: location=101010100 or location=116.41,39.92
  • date(required)Set the date, up to 60 days in the future (including today). The date format is yyyyMMdd. Example: date=20200531

Sample Code

QWeather.getSun(Context context, String location, String date, final OnResultSunListener listener) ;

QWeather.getSun(Context context, String location, Lang lang, String date, final OnResultSunListener listener) 

Properties

Properties of SunBean

Property Description Example
getCode See Status Code 200
getRefer Reference data, includes data source, statements and license Refer
getSunrise Sunrise time. Maybe null in high latitude area 2017-10-25T06:01+08:00
getSunset Sunset time. Maybe null in high latitude area 2017-10-25T18:01+08:00

Refer

Property Description Example
getSourcesList Data source and other statements QWeather
getLicenseList Data license QWeather Developers License

Basic

Property Description Example
getUpdateTime Last updated time 2017-10-25T04:34+08:00
getFxLink Responsive web page of this location, easy to embed in your website or APP https://www.qweather.com/weather/beijing-101010100.html