PHP time() Function

Description

PHP represents time as the number of seconds that have passed since January 1st 1970 00:00:00 GMT.

time() gets the current time in epoch format.

Syntax

PHP time() Function has the following syntax.

int time ( void )

Example

Gets the current time in epoch format


<?PHP//  w ww .j av a2 s.co m
print time(); 
$CurrentTime = time(); 
print $CurrentTime; 
?>

For more precise time values, use the microtime() function.

The code above generates the following result.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions