I search a way to calculate sunrise and -set for a given timezone aka location. I would like something similar to Zend_Date.
The idea is to have an application where you can select a location and based on that you get the actual time and also sunrise, -set time.
Cheers and thanks,
-lony
Take a look at sunrisesunsetlib-java which calculates the sunrise/sunset times from GPS coordinates and a date.
You might want to use commons-suncalc, a dependency-free library for Java ⩾7:
Date date = // date of calculation
double lat, lng = // geolocation
SunTimes times = SunTimes.compute()
.on(date) // set a date
.at(lat, lng) // set a location
.execute(); // get the results
System.out.println("Sunrise: " + times.getRise());
System.out.println("Sunset: " + times.getSet());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With