php: convert milliseconds to date

Solution 1:

You are already doing it right, 1227643821 is simply not 02-12-2008, it is indeed 25-11-2008.

Solution 2:

I just added H:i:s like in the below example:

$mil = 1227643821310;
$seconds = $mil / 1000;
echo date("d/m/Y H:i:s", $seconds);

Solution 3:

$mil = 1227643821310;
$seconds = ceil($mil / 1000);
echo date("d-m-Y", $seconds);

Solution 4:

The only thing I can think of is try rounding off the decimal portion before converting it to a date. If that doesn't change the result, then the result is correct.