gettimeofday()

In PHP by using gettimeofday function we can get the time elapsed between current time and Unix Epoch time. We get an array in return.
Here is the syntax
gettimeofday();
We will try to generate output by using this. Here is the sample code
print_r(gettimeofday());
The output of above code is here
Array
(
    [sec] => 1503496592
    [usec] => 27258
    [minuteswest] => 0
    [dsttime] => 0
)
The first element [sec] gives the time in seconds elapsed between Unix Epoch time and current time.
The second element [usec] gives in microseconds.
[minuteswest] - minutes west of Greenwich
[dsttime] - type of dst correction
All these data are related to server side and not the local time of the client computer.

Getting float data

Instead of an array we can get float value like this.
echo gettimeofday(true);
The output is here.
1503496592.03
Refresh this page and see how the data is changing

Subscribe to our mailing list

* indicates required
Subscribe to plus2net
Your Rating


Google+



More On Date Object

Post Comment This is for short comments only. Use the forum for more discussions.




Subscribe to our mailing list

* indicates required
Subscribe to plus2net
HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us
©2000-2017 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer