Skip to content
Calculate sunset and sunrise on a given day on a given location
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Here's a class for calculating an approximate time of the sunset, sunrise and day length on a given date, on a given location (latitude coordinate). It takes into account leap years and daylight saving time offset.
It's accurate to about 20 minutes (compared to results from WolframAlpha).

Also, because the constructor Date(int year, int month, int day) is marked as deprecated, GregorianCalendar class is used instead.

Main article:
Something went wrong with that request. Please try again.