date_sunrise
Returns time of sunrise for a given day and location.
date_sunrise Function synopsis
#[\Deprecated]
date_sunrise(
int $timestamp,
int $returnFormat = SUNFUNCS_RET_STRING,
?float $latitude = null,
?float $longitude = null,
?float $zenith = null,
?float $utcOffset = null
): string|int|float|false
Parameters
$timestamp
Typeint
The $timestamp of the day from which the sunrise
time is taken.
$returnFormat
OptionalTypeintDefault valueSUNFUNCS_RET_STRING
$latitude
OptionalType?floatDefault valuenull
Defaults to North, pass in a negative value for South.
See also: date.default_latitude
$longitude
OptionalType?floatDefault valuenull
Defaults to East, pass in a negative value for West.
See also: date.default_longitude
$zenith
OptionalType?floatDefault valuenull
$zenith is the angle between the center of the sun
and a line perpendicular to earth's surface. It defaults to
date.sunrise_zenith
$utcOffset
OptionalType?floatDefault valuenull
Specified in hours.
The $utcOffset is ignored, if
$returnFormat is
SUNFUNCS_RET_TIMESTAMP.
Return value
Typestring|int|float|false
Returns the sunrise time in a specified $returnFormat on
success or false on failure. One potential reason for failure is that the
sun does not rise at all, which happens inside the polar circles for part of
the year.
Changes to the date_sunrise Function
PHP 8.4
- Attribute added:
#[Deprecated]
PHP 8.1
- Function deprecated
PHP 8.0
- Return type added:
string|int|float|false - Parameter name of parameter #1 changed:
$timeto$timestamp - Parameter type added for parameter #1 (
$timestamp):int - Parameter name of parameter #2 changed:
$formatto$returnFormat - Parameter type added for parameter #2 (
$returnFormat):int - Parameter default value added for position #2 (
$returnFormat):SUNFUNCS_RET_STRING - Parameter type added for parameter #3 (
$latitude):?float - Parameter default value added for position #3 (
$latitude):null - Parameter type added for parameter #4 (
$longitude):?float - Parameter default value added for position #4 (
$longitude):null - Parameter type added for parameter #5 (
$zenith):?float - Parameter default value added for position #5 (
$zenith):null - Parameter name of parameter #6 changed:
$gmt_offsetto$utcOffset - Parameter type added for parameter #6 (
$utcOffset):?float - Parameter default value added for position #6 (
$utcOffset):null
date_sunrise(
- $time,
+ int $timestamp,
- $format,
+ int $returnFormat = SUNFUNCS_RET_STRING,
- $latitude,
+ ?float $latitude = null,
- $longitude,
+ ?float $longitude = null,
- $zenith,
+ ?float $zenith = null,
- $gmt_offset
+ ?float $utcOffset = null
- )
+ ): string|int|float|false date_sunrise Function Availability
date_sunrise Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Future Release | Yes Deprecated |
| PHP 8.5Upcoming Release | Yes Deprecated |
| PHP 8.4Supported (Latest) | Yes Deprecated |
| PHP 8.3Supported | Yes Deprecated |
| PHP 8.2Security-Fixes Only | Yes Deprecated |
| PHP 8.1Security-Fixes Only | Yes Deprecated |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |