PHP gettimeofday() function

PHP getdate() function
PHP gmdate() function

In this article, you will learn how to get the current time of the day. The PHP gettimeofday() function returns the current time of the day.

Note: This function returns the current time of the day according the server on which the PHP script is running.

What is the syntax of the gettimeofday() function in PHP?

gettimeofday(return_float)
ParameterDescription
return_floatOptional. When set to TRUE, a float instead of an array is returned. Default is FALSE
PHP gettimeofday() method

Example of the gettimeofday() function

Example 1. In this example, we simply return the current time. First we print the array from gettimeofday() method and then print the float from gettimeofday() method.

<?php
print_r(gettimeofday());

echo gettimeofday(true);
?>

PHP getdate() function
PHP gmdate() function
en English
X
Scroll to Top