Timestamp To Date Converter

Convert timestamp to date or date to timestamp easily

How To Get Current Timestamp In PHP

There is multiple ways how to get current timestamp in PHP.

Using function time

Function time returns current Unix timestamp (number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).


echo time();
# 1713058111

Using function microtime

Function microtime returns current Unix timestamp with microseconds.


echo microtime(true);
# 1713058111.3503

Using class DateTime

Class DateTime provides an object oriented approach for date and time manipulation.


$d1 = new Datetime();
echo $d1->format('U');
# 1713058111
$d2 = new Datetime("now");
echo $d2->format('U');
# 1713058111
This website uses cookies to ensure you get the best experience on our website. More info