❮ PHP Date/Time Reference
Example
Return the current Unix timestamp with microseconds:
Try it Yourself »
Definition and Usage
The microtime[] function returns the current Unix timestamp with microseconds.
Syntax
Parameter Values
return_float | Optional. When set to TRUE it specifies that the function should return a float, instead of a string. Default is FALSE |
Technical Details
Returns the string "microsec sec" by default, where sec is the number of seconds since the Unix Epoch [0:00:00 January 1, 1970 GMT], and microsec is the microseconds part. If the return_float parameter is set to TRUE, it returns a float representing the current time in seconds since the Unix epoch accurate to the nearest microsecond |
4+ |
PHP 5.0: Added the return_float parameter |
❮ PHP Date/Time Reference
What is the use of Microtime [] function?
The microtime [] function returns the current Unix timestamp with microseconds. Optional. When set to TRUE it specifies that the function should return a float, instead of a string.
How to get the current Unix timestamp in PHP using Microtime?
PHP microtime [] function returns the current Unix timestamp. By default this returns a string value in the form msec sec. If you pass the boolean value true as a parameter to this method, it returns the current time in seconds since the Unix epoch accurate to the nearest microsecond.
What are the exceptions to the Microtime [] function in PHP?
Exceptions: The microtime [] function is only available on operating systems that support the gettimeofday [] system call. Below programs illustrate the microtime [] function in PHP:
What does Microtime [] return in Python?
If as_float is set to true, then microtime [] returns a float, which represents the current time in seconds since the Unix epoch accurate to the nearest microsecond.
What is microtime?
Definition of microtime
: a very short interval of time [as 0.01 millionth of a second] microtime photography.
Is microtime in seconds?
By default, microtime[] returns a string in the form "msec sec", where sec is the number of seconds since the Unix epoch [0:00:00 January 1,1970 GMT], and msec measures microseconds that have elapsed since sec and is also expressed in seconds as a decimal fraction.
What is PHP time function?
The time[] function returns the current time in the number of seconds since the Unix Epoch [January 1 1970 00:00:00 GMT].