Unix Timestamp in PHP
Look up the current epoch time and convert between Unix seconds and UTC dates in PHP.
Get the current timestamp
<?php
echo time(), PHP_EOL;Timestamp to date
<?php
echo (new DateTimeImmutable("@1700000000"))->format(DATE_ATOM), PHP_EOL;Date to timestamp
<?php
echo (new DateTimeImmutable("2023-11-14T22:13:20Z"))->getTimestamp(), PHP_EOL;Open 1700000000 in the converter
Current Unix time
Seconds—
Milliseconds—
- UTC
- —
- My time zone
- —
Free to use. Your input stays in this browser.
How to use it
- Copy the current-time example into your PHP environment to read Unix seconds.
- Run the second example to display 1700000000 as a UTC date.
- Run the last example to convert that date back into seconds.
time() returns whole seconds. The @ prefix constructs a UTC DateTimeImmutable from a Unix timestamp, and getTimestamp() returns seconds.