Easy Tutorial
❮ Func Array Ksort Func Simplexml Asxml ❯

PHP date_sunrise() Function

PHP Date/Time Reference Manual

Example

Returns today's sunrise time in Lisbon, Portugal:


Definition and Usage

The date_sunrise() function returns the sunrise time for a specified date and location.

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

Syntax

Parameter Description
timestamp Required. Specifies the date timestamp for which to calculate the sunrise time.
format Optional. Specifies how to return the result: SUNFUNCS_RET_STRING (returns the result as a string, e.g., 16:46) (default)<br> SUNFUNCS_RET_DOUBLE (returns the result as a float, e.g., 16.78243132)<br> SUNFUNCS_RET_TIMESTAMP (returns the result as an integer (timestamp), e.g., 1095034606)
latitude Optional. Specifies the latitude of the location. Defaults to North. To specify South, pass a negative value.
longitude Optional. Specifies the longitude of the location. Defaults to East. To specify West, pass a negative value.
zenith Optional. Defaults to date.sunrise_zenith.
gmtoffset Optional. Specifies the difference between GMT and local time in hours.

Technical Details

Return Value: Returns the sunrise 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 Ksort Func Simplexml Asxml ❯