Fonction PHP heure locale()
Exemple
Affiche l'heure locale sous forme de tableau indexé et associatif :
<?php
print_r(localtime());
echo "<br><br>";
print_r(localtime(time(),true));
?>
Définition et utilisation
La fonction localtime() renvoie l'heure locale.
Syntaxe
localtime(timestamp, is_assoc)
Valeurs des paramètres
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:
|
Détails techniques
Valeur de retour : | Renvoie un tableau contenant les composants d'un horodatage Unix |
---|---|
Version PHP : | 4+ |
Journal des modifications PHP : | PHP 5.1 : émet désormais les erreurs de fuseau horaire E_STRICT et E_NOTICE |
❮ Référence date/heure PHP