PHP gettimeofday() Function

What is a Get Time Of Day Function?

Explanation

The "gettimeofday()" function returns the current time.

Syntax:


gettimeofday(return_float)

In the above syntax the "return_float" is an optional field, which returns a float value if its set to true, the above function returns the following array keys "sec" for seconds since the unix epoch, "usec" for microseconds, "Minuteswest" for minutes west of greenwich, "dsttime" for the type of dst correction.

Example :


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

1138111447.4
Array
(
[sec] => 1138111447
[usec] => 395863
[minuteswest] => -60
[dsttime] => 0
)

In the above example the "gettimeofday()" function returns the values such of sec, usec, minuteswest, desttime as an array.

Note :

(PHP 4, PHP 5)

PHP Topics


Ask Questions

Ask Question