PHP gettimeofday

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : gettimeofday() function

Description

The gettimeofday() function is used to get current time information.

Version

(PHP 4 and above)

Syntax

gettimeofday(return_float)

Parameters

Name

Description

Required /
Optional

Type

return_float

When setting to TRUE, a float instead of an array is returned.

Optional

Float

 

Return value

An associative array. If return_float is set, then a float is returned.
Array elements details :

Key

Description

sec

seconds since the Unix Epoch.

usec

Microseconds.

minuteswest

Minutes west of Greenwich.

dsttime

Type of dst correction

 

Example :

  1. print_r(gettimeofday());  

  2. ?>   

Output :

Array ( [sec] => 1281420398 [usec] => 985536 [minuteswest] => 0 [dsttime] => 0 )

Note : Since the current time is not static, therefore the output may vary.