note 41328 added to function.strtotime
| From: | cryogen at mac dot com | Date: | Tue, 06 Apr 2004 15:39:04 +0000 |
| Subject: | note 41328 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67718@lists.php.net to get a copy of this message | ||
I neglected to include the solution in my last post for using strtotime() with date-time data stored
in GMT. 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!
?>
----
Manual Page -- http://www.php.net/manual/en/function.strtotime.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41328
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41328&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41328&report=yes
Search -- http://master.php.net/manage/user-notes.php