To convert timestamp to string, use setTimestamp(). Let’s say the following is our input i.e. timestamp −
$SQLTimestamp = 1600320600000;
We want the following output i.e. Date string −
2020-09-17 05:30:00
At first, get seconds from Timestamp −
$seconds = round($SQLTimestamp/1000, 0);
Example
<!DOCTYPE html>
<html>
<body>
<?php
$SQLTimestamp = 1600320600000;
$seconds = round($SQLTimestamp/1000, 0);
$PHPDateObject = new DateTime();
$PHPDateObject->setTimestamp($seconds);
echo $PHPDateObject->format('Y-m-d H:i:s');
?>
</body>
</html>Output
2020-09-17 05:30:00