Web Analytics

PHP gettimeofday() Function

Date/Time FunctionPHP 4+

The gettimeofday() function returns the current time, with microsecond precision.

Syntax

gettimeofday(bool $as_float = false): array|float

Parameters

  • as_float: If set to true, a float is returned instead of an array.

Return Value

By default, returns an associative array with members: sec, usec, minuteswest, dsttime. If as_float is true, returns a float.

Try It Online

Output
Click Run to execute your code

Related Functions

  • microtime() - Return current Unix timestamp with microseconds
  • time() - Return current Unix timestamp