PHP -zelfstudie

PHP HOME PHP-intro PHP-installatie PHP-syntaxis PHP-opmerkingen PHP-variabelen PHP-echo / afdrukken PHP-gegevenstypen PHP-strings PHP-nummers PHP-wiskunde PHP-constanten PHP-operators PHP Als...Anders...Anders PHP-switch PHP-loops PHP-functies PHP-arrays PHP Superglobals PHP RegEx

PHP- formulieren

PHP-formulierverwerking PHP-formuliervalidatie PHP-formulier vereist URL/e-mail van PHP-formulier PHP-formulier voltooid

PHP Geavanceerd

PHP-datum en tijd PHP opnemen PHP-bestandsverwerking PHP-bestand openen/lezen PHP-bestand maken/schrijven PHP-bestand uploaden PHP-cookies PHP-sessies PHP-filters PHP-filters geavanceerd PHP-callback-functies PHP JSON PHP-uitzonderingen

PHP OOP

PHP Wat is OOP PHP-klassen/objecten PHP-constructor PHP-vernietiger PHP-toegangsmodificaties PHP-overerving PHP-constanten PHP abstracte lessen PHP-interfaces PHP-kenmerken PHP statische methoden Statische eigenschappen van PHP PHP-naamruimten PHP-iterables

MySQL- database

MySQL-database MySQL Connect MySQL DB maken MySQL-tabel maken MySQL Gegevens invoegen MySQL Laatste ID ophalen MySQL Meerdere invoegen MySQL voorbereid MySQL Gegevens selecteren MySQL Waar MySQL Bestel op MySQL Gegevens verwijderen MySQL-updategegevens MySQL-limietgegevens

PHP XML

PHP XML-parsers PHP SimpleXML-parser PHP SimpleXML - Get PHP XML Expat PHP XML DOM

PHP - AJAX

Ajax-intro AJAX PHP AJAX-database AJAX XML Live zoeken in Ajax Ajax-peiling

PHP- voorbeelden

PHP-voorbeelden PHP-compiler PHP-quiz PHP-oefeningen PHP-certificaat

PHP- referentie

PHP-overzicht PHP-array PHP-agenda PHP-datum PHP-map PHP-fout PHP-uitzondering PHP-bestandssysteem PHP-filter PHP FTP PHP JSON PHP-sleutelwoorden PHP Libxml PHP-e-mail PHP-wiskunde PHP Diversen PHP MySQLi PHP-netwerk PHP-uitvoercontrole PHP RegEx PHP SimpleXML PHP-stream PHP-string Beheer van PHP-variabelen PHP XML-parser PHP-zip PHP-tijdzones

PHP date_sunset() Functie

❮ PHP Datum/Tijd Referentie

Voorbeeld

Retourneer vandaag de zonsondergang voor Lissabon, Portugal:

<?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));
?>

Definitie en gebruik

De functie date_sunset() retourneert de zonsondergangstijd voor een opgegeven dag en locatie.

Tip: Kijk naar de functie date_sunrise() om de zonsopgangstijd voor een bepaalde dag en locatie te retourneren.


Syntaxis

date_sunset(timestamp, format, latitude, longitude, zenith, gmtoffset)

Parameterwaarden

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:

  • SUNFUNCS_RET_STRING (returns the result as string. e.g. 16:46) (This is default)
  • SUNFUNCS_RET_DOUBLE (returns the result as float. e.g. 16.78243132)
  • SUNFUNCS_RET_TIMESTAMP (returns the result as integer (timestamp). e.g. 1095034606)
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


Technische details

Winstwaarde: Retourneert de tijd van de zonsondergang, in het opgegeven formaat, bij succes. ONWAAR bij fout
PHP-versie: 5+
Wijzigingslogboek: Vanaf PHP 5.1.0 genereert deze functie E_STRICT en E_NOTICE tijdzone fouten

❮ PHP Datum/Tijd Referentie