PHP date_sunset() Funzione
Esempio
Ritorna l'ora del tramonto per Lisbona, Portogallo oggi:
<?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));
?>
Definizione e utilizzo
La funzione date_sunset() restituisce l'ora del tramonto per un giorno e una posizione specificati.
Suggerimento: guarda la funzione date_sunrise() per restituire l'ora dell'alba per un giorno e una posizione specificati.
Sintassi
date_sunset(timestamp, format, latitude, longitude, zenith, gmtoffset)
Valori dei parametri
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 |
Dettagli tecnici
Valore di ritorno: | Restituisce l'ora del tramonto, nel formato specificato, in caso di esito positivo. FALSO in caso di fallimento |
---|---|
Versione PHP: | 5+ |
Registro delle modifiche: | Da PHP 5.1.0 questa funzione genera errori di fuso orario E_STRICT e E_NOTICE |
❮ Riferimento di data/ora PHP