Free API to Get Sunrise, Sunset Time of any Location

0 Comments
Editor Ratings:
User Ratings:
[Total: 1 Average: 5]




Here is a free API to get sunrise, sunset time of any location. And not any location but you can use this API to get sunrise and sunset times of any specific date as well. Name of this API is Sunset Sunrise and to use it, you just have to make a simple API call to the specified endpoint and it returns a response in JSON format. In the result, you can see the sunset time, sunrise time, solar noon, day length, civil twilight begin, civil twilight end, astronomical twilight begin, astronomical twilight end, and some others. You can easily see data about all these parameters and then do whatever you want.

If you want sunrise and sunset time data for you mobile and web applications then this is a simple API for that. Without any account , you just have to make API calls and get the data. However, the times that it include are in UTC format. If you want to see the actual time based on your timezone then you will have to use some external tools. Or, while using this API in your applications, you will have to make certain adjustments to show the correct time.

Free API to Get Sunrise, Sunset Time of any Location

Using this Free API to Get Sunrise, Sunset Time of any Location:

I have already mentioned that you don’t require an account here to start using this API. In the API call URL, you just have to specify the latitude, longitude and date parameters. After that, you just analyze the JSON data and do whatever you like.

Construct the API call URL in the below format. And then paste it in the browser or use cURL. It will immediately return the data in JSON that you can use anywhere you like. The following example return the sunrise and sunset data for a specific date.

https://api.sunrise-sunset.org/json?lat=LAT&lng=LON&date=Date

sunrise sunset time specific date

If you want to get the sunrise and sunset data for today. then you use the following syntax. Analyze the data it produces.

https://api.sunrise-sunset.org/json?lat=LAT&lng=LON&date=Date

sunrise sunset time today

To convert the time that it uses to denote sunrise and sunset, you can use an online tool, Savvy Time. You can use this website to convert UTC time to any other time zone you want. For example, in the below screengrab I tried to convert the sunrise and sunset time I got from this API to match Indian time zone.

Time converter Savvy Time

This way, this simple API works to show you the sunrise and sunset time from any location. You just have to specify the location information to get the data. You can use the JSON data in your application or use other tools to convert it to CSV, XML, etc.

Closing thoughts

Sunset Sunrise is a very nice API for developers and individuals to fetch accurate sunrise and sunset time. Just make a simple request and you are done. And what I liked most about this API is that you can see some other additional parameters as well. Also, it can show sunrise and sunset data of any specific date which is great. So, if you are looking for sunset and sunrise times API then one mentioned above will be very helpful.

Editor Ratings:
User Ratings:
[Total: 1 Average: 5]
Free/Paid: Free

Get 100 GB FREE

Provide details to get this offer