Funkce PHP localtime() .
Příklad
Tisk místního času jako indexované a jako asociativní pole:
<?php
print_r(localtime());
echo "<br><br>";
print_r(localtime(time(),true));
?>
Definice a použití
Funkce localtime() vrací místní čas.
Syntax
localtime(timestamp, is_assoc)
Hodnoty parametrů
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:
|
Technické údaje
Návratová hodnota: | Vrátí pole, které obsahuje součásti unixového časového razítka |
---|---|
Verze PHP: | 4+ |
PHP Changelog: | PHP 5.1: Nyní vydává chyby časových pásem E_STRICT a E_NOTICE |
❮ Reference data/času PHP