PHP date_sun_info () function
PHP Date / Time Reference Manual
Examples
Returns information about the January 1, 2013, latitude 31.7667, longitude 35.2333 sunrise / sunset and dusk dusk end information /:
<?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>";
}
?>
$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>";
}
?>
Running instance »
Definition and Usage
date_sun_info () function returns a specified date and location of the relevant sunrise / sunset information arrays start at dusk and end at dusk / include.
Tip: See date_sunrise () function returns the specified date and location of the sunrise time.
Tip: See date_sunset () function returns the specified date and location of the sunset times.
grammar
date_sun_info( timestamp,latitude,longitude);
参数 | 描述 |
---|---|
timestamp | 必需。规定时间戳。 |
latitude | 必需。规定纬度。 |
longitude | 必需。规定经度。 |
technical details
return value: | If successful, it returns an array if it fails it returns FALSE. |
---|---|
PHP version: | 5.1.2+ |
PHP Date / Time Reference Manual