PHP 8.0.26 Released!


(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.


This function has no parameters.

Return Values

Returns the current timestamp.


Example #1 time() example

echo 'Now: 'time();

The above example will output something similar to:

Now: 1660338149



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

See Also

add a note

User Contributed Notes 1 note

r at rcse dot de
15 days ago
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.
To Top