Funkcja PHP date_sunrise()
❮ Odniesienie do daty/godziny w PHP
Przykład
Zwróć dziś czas wschodu słońca w Lizbonie w Portugalii:
<?php
// Lisbon, Portugal:
// Latitude: 38.4 North, Longitude: 9 West
// Zenith ~= 90, offset: +1 GMT
echo("Lisbon, Portugal: Date: " . date("D M d Y"));
echo("<br>Sunrise time: ");
echo(date_sunrise(time(),SUNFUNCS_RET_STRING,38.4,-9,90,1));
?>
Definicja i użycie
Funkcja date_sunrise() zwraca czas wschodu słońca dla określonego dnia i lokalizacji.
Wskazówka: spójrz na funkcję date_sunset() , aby zwrócić czas zachodu słońca dla określonego dnia i lokalizacji.
Składnia
date_sunrise(timestamp, format, latitude, longitude, zenith, gmtoffset)
Wartości parametrów
Parameter | Description |
---|---|
timestamp | Required. Specifies the timestamp of the day from which the sunrise time is taken |
format |
Optional. Specifies how to return the result:
|
latitude | Optional. Specifies the latitude of the location. Defaults to North. To specify a value for South, pass in a negative value |
longitude | Optional. Specifies the longitude of the location. Defaults to East. To specify a value for West, pass in a negative value |
zenith | Optional. Defaults to date.sunrise_zenith |
gmtoffset | Optional. Specifies the difference between GMT and local time in hours |
Szczegóły techniczne
Wartość zwrotu: | W przypadku powodzenia zwraca czas wschodu słońca w określonym formacie . FAŁSZ w przypadku niepowodzenia |
---|---|
Wersja PHP: | 5+ |
Dziennik zmian PHP: | PHP 5.1: Ta funkcja wyświetla teraz błędy stref czasowych E_STRICT i E_NOTICE |
❮ Odniesienie do daty/godziny w PHP