gettimeofday()In PHP by using gettimeofday function we can get the time elapsed between current time and Unix Epoch time. We get an array in return.
Here is the syntax
We will try to generate output by using this. Here is the sample code
The output of above code is here
The first element [sec] gives the time in seconds elapsed between Unix Epoch time and current time.
The second element [usec] gives in microseconds.
[minuteswest] - minutes west of Greenwich
[dsttime] - type of dst correction
All these data are related to server side and not the local time of the client computer.
Getting float dataInstead of an array we can get float value like this.
The output is here.
Refresh this page and see how the data is changing
More On Date Object
PHP Date & Time class creating and examples of uses
Creating a date interval object and using with php date object
Adding date interval to date object to create new dates
Difference in date by using diff function and using date object
Add or subtract from date object using modify function
Changing parameters of the date object by using setdate function
updating time for a date object to a new value
Gettign the time zone setting of the server
Setting the default time zone of server
Array of time zones available for setting ( total list )
Getting time in seconds elapsed from Epoch time
Local time of the server or different time zones by using localtime() function