Retrieve information about sunrise, sunset, and twilight begin/end for January 1, 2013, at latitude 31.7667 and longitude 35.2333.
<?php $sun_info=date_sun_info(strtotime(“2013-01-01”),31.7667,35.2333); foreach ($sun_info as $key=>$val) { echo “$key: “ . date(“H:i:s”,$val) . “<br>”; } ?> |
The date_sun_info() function returns an array with information about sunset, sunrise, and twilight begin/end for a given day and location.
Tip: Use the date_sunrise() function to get the sunrise time for a specific day and location.
Tip: Use the date_sunset() function to get the sunset time for a specific day and location.
date_sun_info(timestamp, latitude, longitude) |
Parameter |
Description |
timestamp |
Required. Specifies a timestamp. |
latitude |
Required. Specifies the latitude in degrees. |
longitude |
Required. Specifies the longitude in degrees. |
Return Value: |
Returns an array on success; FALSE on failure. |
PHP Version: |
5.1.2+ |