Dutch PHP Conference 2025 - Call For Papers

time

(PHP 4, PHP 5, PHP 7, PHP 8)

timeReturn current Unix timestamp

Опис

time(): int

Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

Зауваження:

Unix timestamps do not contain any information with regards to any local timezone. It is recommended to use the DateTimeImmutable class for handling date and time information in order to avoid the pitfalls that come with just Unix timestamps.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

Returns the current timestamp.

Приклади

Приклад #1 time() example

<?php
echo 'Now: '. time();
?>

Поданий вище приклад виведе щось схоже на:

Now: 1660338149

Примітки

Підказка

Timestamp of the start of the request is available in $_SERVER['REQUEST_TIME'].

Прогляньте також

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top