Return information about sunset/sunrise and twilight begin/end on 1st January, 2013, for latitude 31.7667, 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>";
}
?>
Try it Yourself »
The date_sun_info() function returns an array containing information about sunset/sunrise and twilight begin/end, for a specified day and location.
Tip: Look at the date_sunrise() function to return the sunrise time for a specified day and location.
Tip: Look at the date_sunset() function to return the sunset time for a specified 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+ |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!