note 16137 deleted from function.strtotime by jimw
| From: | jimw@php.net | Date: | Fri, 14 Dec 2001 20:58:09 +0000 |
| Subject: | note 16137 deleted from function.strtotime by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22804@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.