Java library to compute the local sunrise and sunset at a given latitude/longitue and date combination. Uses the algorithm found at https://web.archive.org/web/20161202180207/http://williams.best.vwh.net/sunrise_sunset_algorithm.htm.
None
Download the jar or clone the repo and run $ mvn clean install to build from source.
You can now use Maven to pull in SunriseSunsetLib into your project, just add:
<dependency>
<groupId>com.luckycatlabs</groupId>
<artifactId>SunriseSunsetCalculator</artifactId>
<version>1.2</version>
</dependency>
to your pom.xml.
If you use gradle, add the following to your build.gradle file:
repositories {
mavenCentral()
}
dependencies {
compile 'com.luckycatlabs:SunriseSunsetCalculator:1.2'
}
Create a SunriseSunsetCalculator with a location and time zone identifier:
Location location = new Location("39.9522222", "-75.1641667");
SunriseSunsetCalculator calculator = new SunriseSunsetCalculator(location, "America/New_York");
Then call the method for the type of sunrise/sunset you want to calculate:
String officialSunrise = calculator.getOfficialSunriseForDate(Calendar.getInstance());
Calendar officialSunset = calculator.getOfficialSunsetCalendarForDate(Calendar.getInstance());
When filing a bug report, please include the following information:
Mike Reedell
Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0