Funkcja PHP date_sunset()
❮ Odniesienie do daty/godziny w PHP
Przykład
Zwróć dziś czas zachodu słońca w Lizbonie, Portugalia:
<?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>Sunset time: ");
echo(date_sunset(time(),SUNFUNCS_RET_STRING,38.4,-9,90,1));
?>
Definicja i użycie
Funkcja date_sunset() zwraca czas zachodu słońca dla określonego dnia i lokalizacji.
Wskazówka: spójrz na funkcję date_sunrise() , aby zwrócić czas wschodu słońca dla określonego dnia i lokalizacji.
Składnia
date_sunset(timestamp, format, latitude, longitude, zenith, gmtoffset)
Wartości parametrów
Parameter | Description |
---|---|
timestamp | Required. Specifies the timestamp of the day from which the sunset 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.sunset_zenith |
gmtoffset | Optional. Specifies the difference between GMT and local time in hours |
Szczegóły techniczne
Wartość zwrotu: | W przypadku powodzenia zwraca czas wygaśnięcia w określonym formacie . FAŁSZ w przypadku niepowodzenia |
---|---|
Wersja PHP: | 5+ |
Dziennik zmian: | Od PHP 5.1.0 ta funkcja generuje błędy stref czasowych E_STRICT i E_NOTICE |
❮ Odniesienie do daty/godziny w PHP