note 41328 deleted from function.strtotime by derick

From: Date: Sun, 14 Dec 2014 11:31:38 +0000
Subject: note 41328 deleted from function.strtotime by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-201158@lists.php.net to get a copy of this message
Note Submitter: cryogen at mac dot com ---- Append the string "GMT" to all of your datetimes pulled from MySQL or other database that store date-times in the format "yyyy-mm-dd hh:ii:ss" just prior to converting them to a unix timestamp with strtotime(). This will ensure you get a valid GMT result for times during daylight savings. EXAMPLE: <?php $date_time1 = strtotime("2004-04-04 02:00:00"); // returns bad value -1 due to DST $date_time2 = strtotime("2004-04-04 02:00:00 GMT"); // works great! ?>

« previous php.notes (#201158) next »