PHP » GoLang |
login |
register |
about
|
|
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 Description
array date_sun_info
( int
$time
, float $latitude
, float $longitude
)Parameters
Return Values
Returns array on success or
The values of the array elements are either UNIX timestamps, Changelog
Examples
Example #1 A date_sun_info() example
<?phpThe above example will output: sunrise: 05:52:11 sunset: 15:41:21 transit: 10:46:46 civil_twilight_begin: 05:24:08 civil_twilight_end: 16:09:24 nautical_twilight_begin: 04:52:25 nautical_twilight_end: 16:41:06 astronomical_twilight_begin: 04:21:32 astronomical_twilight_end: 17:12:00 Example #2 Polar night
<?phpThe above example will output:
array(9) {
["sunrise"]=>
bool(false)
["sunset"]=>
bool(false)
["transit"]=>
int(1513857490)
["civil_twilight_begin"]=>
bool(false)
["civil_twilight_end"]=>
bool(false)
["nautical_twilight_begin"]=>
bool(false)
["nautical_twilight_end"]=>
bool(false)
["astronomical_twilight_begin"]=>
bool(false)
["astronomical_twilight_end"]=>
bool(false)
}
Example #3 Midnight sun
<?phpThe above example will output:
array(9) {
["sunrise"]=>
bool(true)
["sunset"]=>
bool(true)
["transit"]=>
int(1498046510)
["civil_twilight_begin"]=>
bool(true)
["civil_twilight_end"]=>
bool(true)
["nautical_twilight_begin"]=>
bool(true)
["nautical_twilight_end"]=>
bool(true)
["astronomical_twilight_begin"]=>
bool(true)
["astronomical_twilight_end"]=>
bool(true)
}
See Also
|
more
Most requested
more
Last requests
|