PHP date_sunset() Function
PHP Date/Time Reference Manual
Example
Return today's sunset time in Lisbon, Portugal:
Sunset time: "); echo(date_sunset(time(),SUNFUNCS_RET_STRING,38.4,-9,90,1)); ?>Run Example »
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
date_sunset(
timestamp,format,latitude,longitude,zenith,gmtoffset);
| Parameters | Description |
|---|---|
| timestamp | Required. Specifies the timestamp of the date for which to calculate the sunset time. |
| format |
Optional. Specifies how to return the result: |
Technical Details
| Return Value: | On success, returns the sunrise time in the specified format Returns the sunset time, or FALSE on failure. |
|---|---|
| PHP Version: | 5+ |
| Changelog: | Since PHP 5.1.0, this function raises E_STRICT and E_NOTICE time zone errors. |
PHP Date/Time Reference Manual