PHP localtime() Functie
Voorbeeld
Druk de lokale tijd af als een geïndexeerde en als een associatieve array:
<?php
print_r(localtime());
echo "<br><br>";
print_r(localtime(time(),true));
?>
Definitie en gebruik
De functie localtime() retourneert de lokale tijd.
Syntaxis
localtime(timestamp, is_assoc)
Parameterwaarden
Parameter | Description |
---|---|
timestamp | Optional. Specifies a Unix timestamp that defaults to the current local time, time(), if no timestamp is specified |
is_assoc | Optional. Specifies whether to return an associative or indexed array. FALSE = the array returned is an indexed array. TRUE = the array returned is an associative array. FALSE is default.
The keys of the associative array are:
|
Technische details
Winstwaarde: | Retourneert een array die de componenten van een Unix-tijdstempel bevat |
---|---|
PHP-versie: | 4+ |
PHP-wijzigingslogboek: | PHP 5.1: geeft nu E_STRICT- en E_NOTICE-tijdzonefouten |
❮ PHP Datum/Tijd Referentie