PHP Tutorial - PHP time() Function

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.


PHP time() Function has the following syntax.

int time ( void )


Gets the current time in epoch format

print time(); 
$CurrentTime = time(); 
print $CurrentTime; 

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

The code above generates the following result.