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();
# 1728041824

Using function microtime

Function microtime returns current Unix timestamp with microseconds.


echo microtime(true);
# 1728041824.0374

Using class DateTime

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


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