Menu Samaritan's Purse

DATE_SUN_INFO

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

SYNTAX

date_sun_info ( int $time , float $latitude , float $longitude ) : array

PARAMETERS

time

Timestamp.

latitude

Latitude in degrees.

longitude

Longitude in degrees.

RETURN

Returns array on success or FALSE on failure. The structure of the array is detailed in the following list:

sunrise The time of the sunrise (zenith angle = 90°35').
sunset The time of the sunset (zenith angle = 90°35').
transit The time when the sun is at its zenith, i.e. has reached its topmost point.
civil_twilight_begin The start of the civil dawn (zenith angle = 96°). It ends at sunrise.
civil_twilight_end The end of the civil dusk (zenith angle = 96°). It starts at sunset.
nautical_twilight_begin The start of the nautical dawn (zenith angle = 102°). It ends at civil_twilight_begin.
nautical_twilight_end The end of the nautical dusk (zenith angle = 102°). It starts at civil_twilight_end.
astronomical_twilight_begin The start of the astronomical dawn (zenith angle = 108°). It ends at nautical_twilight_begin.
astronomical_twilight_end The end of the astronomical dusk (zenith angle = 108°). It starts at nautical_twilight_end.

The values of the array elements are either UNIX timestamps, FALSE if the sun is below the respective zenith for the whole day, or TRUE if the sun is above the respective zenith for the whole day.

EXAMPLES

1

Array
(
    [sunrise] => 981210987
    [sunset] => 981246821
    [transit] => 981228904
    [civil_twilight_begin] => 981209153
    [civil_twilight_end] => 981248656
    [nautical_twilight_begin] => 981207075
    [nautical_twilight_end] => 981250733
    [astronomical_twilight_begin] => 981205039
    [astronomical_twilight_end] => 981252770
)

2

sunrise: 14:36:27
sunset: 00:33:41
transit: 19:35:04
civil_twilight_begin: 14:05:53
civil_twilight_end: 01:04:16
nautical_twilight_begin: 13:31:15
nautical_twilight_end: 01:38:53
astronomical_twilight_begin: 12:57:19
astronomical_twilight_end: 02:12:50

3

Array
(
    [sunrise] =>
    [sunset] =>
    [transit] => 1513857490
    [civil_twilight_begin] =>
    [civil_twilight_end] =>
    [nautical_twilight_begin] =>
    [nautical_twilight_end] =>
    [astronomical_twilight_begin] =>
    [astronomical_twilight_end] =>
)

4

Array
(
    [sunrise] => 1
    [sunset] => 1
    [transit] => 1498046510
    [civil_twilight_begin] => 1
    [civil_twilight_end] => 1
    [nautical_twilight_begin] => 1
    [nautical_twilight_end] => 1
    [astronomical_twilight_begin] => 1
    [astronomical_twilight_end] => 1
)

PHP