服务时区设置为+8,在命令行行下显示正常,中设置服务器所在时区为+0800,可输出的时时间却怎么也不对,导致outlookRSS订阅中显示的文章时间也不对均为GMT+1600时区,哪有这样的时区哦,时区范围GMT-1200~GMT+1200。

修改方法如下:

1、修改htdocs\modules\\class\feedcreator.class.php文件中739行附近FeedDate类的构造函数FeedDate如下:

   1: function FeedDate($dateString="") {
   2:     $tzOffset = 0;
   3:     if ($dateString=="") $dateString = date("r");
   4:  
   5:     //if (is_integer($dateString)) {
   6:     if (is_numeric($dateString)) {
   7:         $this->unix = $dateString;
   8:         return;
   9:     }
  10:    // By XuYong 调整日期格式
  11:     if (preg_match("~(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s+)?(\\d{1,2})\\s+([a-zA-Z]{3})\\s+(\\d{4})\\s+(\\d{2}):(\\d{2}):(\\d{2})\\s+(.*)~",$dateString,$matches)) {
  12:         $months = Array("Jan"=>1,"Feb"=>2,"Mar"=>3,"Apr"=>4,"May"=>5,"Jun"=>6,"Jul"=>7,"Aug"=>8,"Sep"=>9,"Oct"=>10,"Nov"=>11,"Dec"=>12);
  13:         $this->unix = gmmktime($matches[4],$matches[5],$matches[6],$months[$matches[2]],$matches[1],$matches[3]);
  14:         if (substr($matches[7],0,1)=='+' OR substr($matches[7],0,1)=='-') {
  15:             $tzOffset = (substr($matches[7],0,3) * 60 + substr($matches[7],-2)) * 60;
  16:         } else {
  17:             if (strlen($matches[7])==1) {
  18:                 $oneHour = 3600;
  19:                 $ord = ord($matches[7]);
  20:                 if ($ord < ord("M")) {
  21:                     $tzOffset = (ord("A") - $ord - 1) * $oneHour;
  22:                 } elseif ($ord >= ord("M") AND $matches[7]!="Z") {
  23:                     $tzOffset = ($ord - ord("M")) * $oneHour;
  24:                 } elseif ($matches[7]=="Z") {
  25:                     $tzOffset = 0;
  26:                 }
  27:             }
  28:             switch ($matches[7]) {
  29:                 case "UT":
  30:                 case "GMT":    $tzOffset = 0;
  31:             }
  32:         }
  33:
  34:         $tzOffset += date("Z",0);
  35:         $this->unix += $tzOffset;
  36:  
  37:         if (TIME_ZONE!="")
  38:         {
  39:             $server_TZ = abs(intval($GLOBALS['xoopsConfig']['server_TZ'] * 3600.0));
  40:             $this->unix += ($server_TZ - date("Z", 0)) % 43200;
  41:         }
  42:  
  43:         return;
  44:     }
  45:     if (preg_match("~(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(.*)~",$dateString,$matches)) {
  46:         $this->unix = gmmktime($matches[4],$matches[5],$matches[6],$matches[2],$matches[3],$matches[1]);
  47:         if (substr($matches[7],0,1)=='+' OR substr($matches[7],0,1)=='-') {
  48:             $tzOffset = (substr($matches[7],0,3) * 60 + substr($matches[7],-2)) * 60;
  49:         } else {
  50:             if ($matches[7]=="Z") {
  51:                 $tzOffset = 0;
  52:             }
  53:         }
  54:         $tzOffset += date("Z",0);
  55:         $this->unix += $tzOffset;
  56:  
  57:         if (TIME_ZONE!="")
  58:         {
  59:             $server_TZ = abs(intval($GLOBALS['xoopsConfig']['server_TZ'] * 3600.0));
  60:             $this->unix += ($server_TZ - date("Z", 0)) % 43200;
  61:         }
  62:         return;
  63:     }
  64:     $this->unix = 0;
  65: }

2、修改htdocs\modules\\class\xml.php文件58行,

原来为:

$TIME_ZONE = $prefix.date(“H:i”, $server_TZ);

修改为:

$TIME_ZONE = $prefix.date(“H:i”, ($server_TZ – date(“Z”, 0)) % 43200); // By XuYong 调整时区显示,防止出现+1600时区