time() gives the timestamp of Greenwich Mean Time (GMT) which is defined as the official time for the whole earth. You get the local time by adding the time zone offset to this timestamp.
(PHP 4, PHP 5, PHP 7, PHP 8)
time — Retourne l'horodatage UNIX actuel
time() retourne l'heure courante, mesurée en secondes depuis le début de l'époque UNIX, (1er janvier 1970 00:00:00 GMT).
Note:
Les horodatages Unix ne contiennent aucune information concernant le fuseau horaire local. Il est recommandé d'utiliser la classe DateTimeImmutable pour manipuler les informations relatives à la date et à l'heure afin d'éviter les écueils liés aux seuls timestamps Unix.
Cette fonction ne contient aucun paramètre.
Retourne l'horodatage actuel.
Exemple #1 Exemple avec time()
<?php
echo 'Aujourd\'hui : '. time();
?>
Résultat de l'exemple ci-dessus est similaire à :
Aujourd'hui : 1660338149
Un horodatage représentant le début de la requête est disponible dans la variable $_SERVER['REQUEST_TIME'].
time() gives the timestamp of Greenwich Mean Time (GMT) which is defined as the official time for the whole earth. You get the local time by adding the time zone offset to this timestamp.