I have a timestamp
1457459333506 (Tue, 08 Mar 2016 17:48:53 GMT)
This should be Unix timestamp with milliseconds. I want to write this as a string, so I'm using
$dt = new DateTime("@$unixTimestamp");
echo date('Y-m-d H:i:s.u', $unixTimestamp) . "<br>";
But the output is 2016-06-08 22:09:22.000000
This is obviously wrong, and has no milisecond precision. So I've tried
echo date('Y-m-d H:i:s.u', $unixTimestamp / 1000) . "<br>";
Which outputs as 2016-03-08 17:48:53.000000 (correct, but also has no milisecond precision).
How can I get this to output correctly as: 2016-03-08 17:48:53.506 ?