gettimeofday()


 

gettimeofday()

This example is about getting the current time information in the array form.

This example is about getting the current time information in the array form.

PHP gettimeofday() Function

The gettimeofday() function returns an array containing current time information. It returns an array by default. It returns float if return_float is set.

Syntax about gettimeofday() Function PHP

gettimeofday(return_float)

Parameter Description of gettimeofday() Function PHP

return_float - Optional. Makes gettimeofday() return a float when it is set to true.

Return Value

The meaning of the returning array keys:

sec - seconds since the Unix Epoch
usec - microseconds
minuteswest - minutes west of Greenwich
dsttime - type of dst correction

Example on gettimeofday() Function PHP:

<?php
echo(gettimeofday(true) . "<br /><br />");
print_r(gettimeofday());
?>

The output of the code above could be:
24514699845.2 

Array
(
[sec] => 24514699845
[usec] => 195863
[minuteswest] => -60
[dsttime] => 0
)

Ads