CodeIgniter Forums
Oh good god, PLEASE help... PHP date() vs. MySQL FROM_UNIXTIME() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Oh good god, PLEASE help... PHP date() vs. MySQL FROM_UNIXTIME() (/showthread.php?tid=46429)



Oh good god, PLEASE help... PHP date() vs. MySQL FROM_UNIXTIME() - El Forum - 10-31-2011

[eluser]Developer13[/eluser]
I am not sure why I'm hung up on this issue, but I am, and it's driving me INSANE!!!

Code:
// The following line outputs 1320040800 (good)
echo strtotime('10/31/2011');

// The following line outputs 10/31/2011 00:00:00 (still good)
echo date('m/d/Y H:i:s', '1320040800');

// The following line outputs 2011-10-30 23:00:00 (what the holy MOTHER@#$%^@#$!??!??)
echo $this->db->query('SELECT FROM_UNIXTIME(1320040800) AS ts')->row()->ts;

Seriously... WTF is going on with this? This is driving me SO insane I'm starting to become normal... and that can't happen!