date_sunset
date_sunset
Returns time of sunset for a given day and location
Waarschuwing: > This function has been as of PHP 8.1.0. Relying on this function is highly discouraged. Use instead. DEPRECATED
date_sun_info
**date_sunset** int $timestamp int $returnFormat $latitude $longitude $zenith $utcOffset
returns the sunset time for a given
day (specified as a ) and location.
date_sunset``timestamp
timestamp
The of the day from which the sunset
time is taken.
timestamp
returnFormat
latitude
Defaults to North, pass in a negative value for South.
See also:
date.default_latitude
longitude
Defaults to East, pass in a negative value for West.
See also:
date.default_longitude
zenith
is the angle between the center of the sun
and a line perpendicular to earth's surface. It defaults to
`zenith`date.sunset_zenith
utcOffset
Specified in hours.
The is ignored, if
is
.
utcOffset``returnFormat``SUNFUNCS_RET_TIMESTAMP
Returns the sunset time in a specified on
successreturn.falseforfailure. One potential reason for failure is that the
sun does not set at all, which happens inside the polar circles for part of
the year.
returnFormat
Voorbeeld: example
<?php
/* calculate the sunset time for Lisbon, Portugal
Latitude: 38.4 North
Longitude: 9 West
Zenith ~= 90
offset: +1 GMT
*/
echo date("D M d Y"). ', sunset time : ' .date_sunset(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1);
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in script on line 10
Deprecated: Function date_sunset() is deprecated since 8.1, use date_sun_info() instead in script on line 10
Mon Dec 20 2004, sunset time : 18:13
Voorbeeld: No sunset
<?php
$solstice = strtotime('2017-12-21');
var_dump(date_sunset($solstice, SUNFUNCS_RET_STRING, 69.245833, -53.537222));
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in script on line 3
Deprecated: Function date_sunset() is deprecated since 8.1, use date_sun_info() instead in script on line 3
bool(false)
date_sun_info