PHP time() Function
In this chapter you will learn:
- Description for PHP time() Function
- Syntax for PHP time() Function
- Example - gets the current time in epoch format
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// jav a 2s.com
print time();
$CurrentTime = time();
print $CurrentTime;
?>
For more precise time values, use the microtime()
function.
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
Home » PHP Tutorial » PHP Date Functions