Bug #14676 Updated: bug: strtotime incorrect GMT conversion from date('r')

From: Date: Sun, 23 Dec 2001 22:03:43 +0000
Subject: Bug #14676 Updated: bug: strtotime incorrect GMT conversion from date('r')
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-74887@lists.php.net to get a copy of this message
ID: 14676 Updated by: derick Reported By: irm@in3activa.net Old Status: Open Status: Closed Bug Type: Date/time related Operating System: win PHP Version: 4.1.0 New Comment: Already fixed, and this will be in the maintenance release 4.1.1, which is due in a few days. Derick Previous Comments: ------------------------------------------------------------------------ [2001-12-23 17:02:48] irm@in3activa.net 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 this bug report at http://bugs.php.net/?id=14676&edit=1

« previous php.dev (#74887) next »