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 — Devuelve la fecha Unix actual
Devuelve el momento actual medido como el número de segundos desde la Época Unix (1 de Enero de 1970 00:00:00 GMT).
Ejemplo #1 Ejemplo de time()
<?php
$semanaSiguiente = time() + (7 * 24 * 60 * 60);
// 7 días; 24 horas; 60 minutos; 60 segundos
echo 'Ahora: '. date('Y-m-d') ."\n";
echo 'Semana Siguiente: '. date('Y-m-d', $semanaSiguiente) ."\n";
// o usar strtotime():
echo 'Semana Siguiente: '. date('Y-m-d', strtotime('+1 week')) ."\n";
?>
El resultado del ejemplo sería algo similar a:
Ahora: 2005-03-30 Semana Siguiente: 2005-04-06 Semana Siguiente: 2005-04-06
La marca de tiempo del inicio de la petición está disponible en $_SERVER['REQUEST_TIME'] desde PHP 5.1.
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.