Home Tutorial Php Phpdate gettimeofday()

 
 

gettimeofday()
Posted on: August 27, 2009 at 12:00 AM
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
)

Related Tags for gettimeofday():


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.