PHP time() Function

Example

Returns the current time as a Unix timestamp and formats it as a date:

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

Running Instances

Definition and Usage

The time() function returns 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 Unix timestamp of the current time.
PHP Version: 4+