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
    [sec] => 1716587550
    [usec] => 484672
    [minuteswest] => 0
    [dsttime] => 0
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 data

Instead of an array we can get float value like this.
echo gettimeofday(true);
The output is here.
Refresh this page and see how the data is changing
PHP Date Functions getTimestamp(): Timestamp from date object
Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    PHP video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer