Easy Tutorial
❮ Func Array Asort Php Xml Dom ❯

PHP date_sunset() Function

PHP Date/Time Reference Manual

Example

Returns today's sunset time in Lisbon, Portugal:


Definition and Usage

The date_sunset() function returns the sunset time for a specified date and location.

Tip: See the date_sunrise() function, which returns the sunrise time for a specified date and location.

Syntax

Parameter Description
timestamp Required. Specifies the date timestamp to calculate the sunset time for.
format Optional. Specifies how to return the result: SUNFUNCS_RET_STRING (returns the result in string format, e.g., 16:46) (default)<br> SUNFUNCS_RET_DOUBLE (returns the result in float format, e.g., 16.78243132)<br> SUNFUNCS_RET_TIMESTAMP (returns the result in integer format (timestamp), e.g., 1095034606)
latitude Optional. Specifies the latitude of the location. Default is north latitude. To specify south latitude, a negative value must be passed.
longitude Optional. Specifies the longitude of the location. Default is east longitude. To specify west longitude, a negative value must be passed.
zenith Optional. Default is date.sunset_zenith.
gmtoffset Optional. Specifies the difference between GMT and local time in hours.

Technical Details

Return Value: Returns the sunset time in the specified format if successful. Returns FALSE if failed.
PHP Version: 5+
--- ---
Changelog: As of PHP 5.1.0, this function throws E_STRICT and E_NOTICE timezone errors.
--- ---
❮ Func Array Asort Php Xml Dom ❯