How to use gettimeofday in PHP

This article describe about gettimeofday() Function in PHP.
  • 3121

gettimeofday() Function

This function contain current time information that return in the array.

Note: Array key return meaning.

  • [sec] - seconds
  • [usec] - microseconds
  • [minuteswest] - minutes west of Greenwich
  • [dsttime] - type of dst correction

Syntax

gettimeofday(return_float)

 

Parameter Description
return_float Optional. This function return float when it is set true.

Example 1

<html>
<body>
<?php
echo(gettimeofday(true) . "<br /><br />");
print_r(gettimeofday());
?>
</body>
</html>

 

Output


pic1.jpg

 

Example 2

 

<html>
<body>
<?php
$my_dt=gettimeofday();
print("$my_dt[sec].$my_dt[usec]");
?>
</body>
<html>

 

Output


pic2.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.