Share on Google+Share on Google+

gettimeofday()

Advertisement
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
)

Advertisements

Advertisement

Posted on: August 27, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.