date_sun_info

It Returns an array with information about sunset/sunrise and twilight begin/end

Example

<?php
$sunInfo = date_sun_info(strtotime(“2006-05-17”), 11.7667, 15.2333);
foreach ($sunInfo as $key => $val) {
echo “$key: ” . date(“H:i:s”, $val) . “<br />”;
}
?>

Output

sunrise: 10:04:55
sunset: 22:45:58
transit: 16:25:27
civil_twilight_begin: 09:42:25
civil_twilight_end: 23:08:28
nautical_twilight_begin: 09:15:57
nautical_twilight_end: 23:34:56
astronomical_twilight_begin: 08:49:06
astronomical_twilight_end: 00:01:47