note 16137 added to function.strtotime

From: Date: Wed, 17 Oct 2001 14:08:26 +0000
Subject: note 16137 added to function.strtotime
Groups: php.notes 
Request: Send a blank email to php-notes+get-19044@lists.php.net to get a copy of this message
Just a warning to people: in converting a MySQL datetime field into a unix timestamp, I got different results using MySQL's built-in UNIX_TIMESTAMP() function versus using PHP's strtotime() function. This occurred on a Linux box set to the GMT timezone, connecting to MySQL running on a box set to the EDT timezone. <br><br>As it turns out, PHP's strttoime() was CORRECT, while MySQL's UNIX_TIMESTAMP() was NOT correct for my purposes. UNIX_TIMESTAMP() was adding six hours to the date. I guess it tries to take the client timezone into account.<br><br>Meanwhile if you are running PHP and MySQL on the same machine you won't see any difference.Something to watch out for, especially if you are doing dev on a different machine from where you deploy your production code, as I was. -- http://www.php.net/manual/en/function.strtotime.php http://master.php.net/manage/user-notes.php?action=edit+16137 http://master.php.net/manage/user-notes.php?action=delete+16137 http://master.php.net/manage/user-notes.php?action=reject+16137

« previous php.notes (#19044) next »