Funzione PHP localtime()
Esempio
Stampa l'ora locale come array indicizzato e associativo:
<?php
print_r(localtime());
echo "<br><br>";
print_r(localtime(time(),true));
?>
Definizione e utilizzo
La funzione localtime() restituisce l'ora locale.
Sintassi
localtime(timestamp, is_assoc)
Valori dei parametri
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:
|
Dettagli tecnici
Valore di ritorno: | Restituisce una matrice che contiene i componenti di un timestamp Unix |
---|---|
Versione PHP: | 4+ |
Registro delle modifiche PHP: | PHP 5.1: ora emette errori di fuso orario E_STRICT e E_NOTICE |
❮ Riferimento di data/ora PHP