PHP has some great code features built into versions as early as PHP 4, even earlier perhaps, though today’s work needs PHP 5. Today, we’ve built a pretty simple web application around PHP’s date/time sun information function …
date_sun_info
(PHP 5 >= 5.1.2, PHP 7)
date_sun_info — Returns an array with information about sunset/sunrise and twilight begin/end
It’s here at this live run link that uses the PHP sun_information.php source code you can download, and try yourself, if you like. Within this code we allow, if access permits the user’s current location be reflected in default latitude and longitude HTML form values via Javascript navigator.geolocation.getCurrentPosition(success[, error[, options]]) call.
If this was interesting you may be interested in this too.