cvs: pear /HTTP_Header Header.php
| From: | Wolfram Kriesing | Date: | Mon, 31 Mar 2003 15:49:15 +0000 |
| Subject: | cvs: pear /HTTP_Header Header.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-9691@lists.php.net to get a copy of this message | ||
cain Mon Mar 31 10:49:15 2003 EDT
Modified files:
/pear/HTTP_Header Header.php
Log:
- the dateToTimestamp() was simply wrong :-(
Index: pear/HTTP_Header/Header.php
diff -u pear/HTTP_Header/Header.php:1.6 pear/HTTP_Header/Header.php:1.7
--- pear/HTTP_Header/Header.php:1.6 Fri Feb 7 05:45:26 2003
+++ pear/HTTP_Header/Header.php Mon Mar 31 10:49:15 2003
@@ -15,7 +15,7 @@
// | Authors: Wolfram Kriesing <wk@visionp.de> |
// | |
// +----------------------------------------------------------------------+//
-// $Id: Header.php,v 1.6 2003/02/07 10:45:26 cain Exp $
+// $Id: Header.php,v 1.7 2003/03/31 15:49:15 cain Exp $
require_once 'PEAR.php';
require_once 'HTTP.php';
@@ -168,16 +168,25 @@
/**
* converts dates like
- * January, 17-Fri-03 14:49:43 GMT
+ * Mon, 31 Mar 2003 15:26:34 GMT
+ * Tue, 15 Nov 1994 12:45:26 GMT
* into a timestamp, strtotime doesnt do it :-(
*/
- function dateToTimestamp( $date )
+ function dateToTimestamp($date)
{
$months =
array_flip(array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'));
- preg_match( '~([^,]*),\s(\d+)-...-(\d+)\s(\d+):(\d+):(\d+).*~' , $date ,
$splitDate );
- $splitDate[1] = substr($splitDate[1],0,3);
- $timestamp = mktime( $splitDate[4] , $splitDate[5] , $splitDate[6] ,
$months[$splitDate[1]]+1 , $splitDate[2] , $splitDate[3] );
+// this was converted, i dont know why January, 17-Fri-03 14:49:43 GMT
+// preg_match( '~([^,]*),\s(\d+)-...-(\d+)\s(\d+):(\d+):(\d+).*~' , $date ,
$splitDate );
+
+ // this returns:
+ // for Mon, 31 Mar 2003 15:42:55 GMT
+ // Array ( [0] => Mon, 31 Mar 2003 15:42:55 GMT
+ // [1] => 31 [2] => Mar [3] => 2003 [4] => 15 [5] => 42 [6] =>
55 )
+
preg_match('~[^,]*,\s(\d+)\s(\w+)\s(\d+)\s(\d+):(\d+):(\d+).*~',$date,$splitDate);
+// $splitDate[1] = substr($splitDate[1],0,3);
+ $timestamp = mktime($splitDate[4],$splitDate[5],$splitDate[6],
+ $months[$splitDate[2]]+1,$splitDate[1],$splitDate[3]);
return $timestamp;
// $dateTime = new I18N_DateTime('de');