Bug #14676: bug: strtotime incorrect GMT conversion from date('r')
| From: | irm at in3activa dot net | Date: | Sun, 23 Dec 2001 22:02:48 +0000 |
| Subject: | Bug #14676: bug: strtotime incorrect GMT conversion from date('r') | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-74886@lists.php.net to get a copy of this message | ||
From: irm@in3activa.net
Operating system: win
PHP version: 4.1.0
PHP Bug Type: Date/time related
Bug description: bug: strtotime incorrect GMT conversion from date('r')
Suppose your machine is GMT+1.
When date('r') returns also GMT+1, strtotime()
shows a bug.
<?
$stamp= "Thu, 20 Dec 2001 09:49:52 +0100";
$stamp= strtotime($stamp);
echo "$stamp = " . date("r", $stamp);
//Shows: 1008481792 = Sun, 16 Dec 2001 06:49:52 +0100
?>
To give you an idea of the solution, I use the
following code to get correct results:
<?
$stamp= "20 Dec 2001 09:49:52 +0100";
// beg patch-line
if( strpos($stamp, date('O')))$stamp= substr($stamp,0,-6);
// end patch-line
$stamp= strtotime($stamp);
echo "$stamp = " . date("r", $stamp);
//Shows: 1008838192 = Thu, 20 Dec 2001 09:49:52 +0100
?>
There is no problem when GMT date('r')
is different from GMT as returned by date('O')
Regards, IRMaturana
--
Edit bug report at: http://bugs.php.net/?id=14676&edit=1