The following code is producing a wrong conversion of a Timestamp (1350553368):
$dateTime = new DateTime();
$dateTime->setTimeStamp(1350553368);
echo $dateTime->format('F n, Y');
PHP converts it to October 10, 2012: http://codepad.viper-7.com/clum0f
However, that timestamp is actually for October 18, 2012: http://www.onlineconversion.com/unix_time.htm
I’m sure it’s me, and not PHP, so what am I doing wrong? The code is pretty straightforward, so I can’t figure it out.
You are using format
'F n, Y'.nis a numeric representation of the month (October is month 10). Used(leading zeroes) orj(no leading zeroes). See PHPdate()reference.