THE WORLD'S LARGEST WEB DEVELOPER SITE

PHP time() Function

❮ PHP Date/Time Reference

Example

Return the current time as a Unix timestamp, then format it to a date:

<?php
$t=time();
echo($t . "<br>");
echo(date("Y-m-d",$t));
?>
Run example »

Definition and Usage

The time() function returns the current time in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).


Syntax

time();

Technical Details

Return Value: Returns an integer containing the current time as a Unix timestamp
PHP Version: 4+

❮ PHP Date/Time Reference