Menu Home

gettimeofday

osbo.com | PHP | Functions | gettimeofday

Get current time

Syntax

gettimeofday ([ bool $return_float = FALSE ] ) : mixed

Parameters

return_float

When set to TRUE, a float instead of an array is returned.

Return

By default an array is returned. If return_float is set, then a float is returned.

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

Examples

void

<?

$return = gettimeofday();

print_r($return);

?>
Array
(
    [sec] => 1619111172
    [usec] => 685619
    [minuteswest] => 0
    [dsttime] => 0
)

return_float

<?

$return_float = true;

$return = gettimeofday($return_float);

echo $return;

?>
1619111172.7162

PHP