|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-12-23 17:03 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 06:00:01 2025 UTC |
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