PHP: gettimeofday() function
PHP: Get current time
The gettimeofday() function is used to get current time information.
Version:
(PHP 4 and above)
Syntax:
gettimeofday(return_float)
Parameters:
Name | Description | Required / Optional |
Type |
---|---|---|---|
return_float | When setting to TRUE, a float instead of an array is returned. | Optional | Float |
Return value:
An associative array. If return_float is set, then a float is returned.
Array elements details:
Key | Description |
---|---|
sec | seconds since the Unix Epoch. |
usec | Microseconds. |
minuteswest | Minutes west of Greenwich. |
dsttime | Type of dst correction |
Example:
<?php
print_r(gettimeofday());
?>
Output:
Array ([sec] => 1281420398 [usec] => 985536 [minuteswest] => 0 [dsttime] => 0 )
Note : Since the current time is not static, therefore the output may vary.
View the example in the browser
See also
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics