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
OptionalTypeint
Default valueSUNFUNCS_RET_STRING
$latitude
OptionalType?float
Default valuenull
Defaults to North, pass in a negative value for South.
See also: date.default_latitude
$longitude
OptionalType?float
Default valuenull
Defaults to East, pass in a negative value for West.
See also: date.default_longitude
$zenith
OptionalType?float
Default 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?float
Default 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.1
- Function deprecated
PHP 8.0
- Return type added:
string|int|float|false
- Parameter name of parameter #1 changed:
$time
to$timestamp
- Parameter type added for parameter #1 (
$timestamp
):int
- Parameter name of parameter #2 changed:
$format
to$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_offset
to$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 AvailabilityPHP Version | Availability |
---|---|
PHP 8.5Future Release | Yes Deprecated |
PHP 8.4Upcoming Release | Yes Deprecated |
PHP 8.3Supported (Latest) | Yes Deprecated |
PHP 8.2Supported | 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 |