Пример #1
0
 /**
  * @param string $strDate
  * @return int
  */
 function GetTimeFromString($strDate)
 {
     $matches = array();
     $datePattern = '/^(([a-z]*),[\\s]*){0,1}(\\d{1,2}).([a-z]*).(\\d{2,4})[\\s]*(\\d{1,2}).(\\d{1,2}).(\\d{1,2})([\\s]+([+-]?\\d{1,4}))?([\\s]*(\\(?(\\w+)\\)?))?/i';
     if (preg_match($datePattern, $strDate, $matches)) {
         $year = $matches[5];
         $month = ap_Utils::GetMonthIndex(strtolower($matches[4]));
         if ($month == -1) {
             $month = 1;
         }
         $day = $matches[3];
         $hour = $matches[6];
         $minute = $matches[7];
         $second = $matches[8];
         $_dt = ap_Utils::GmtMkTime($hour, $minute, $second, $month, $day, $year);
         $zone = null;
         if (isset($matches[13])) {
             $zone = strtolower($matches[13]);
         }
         $off = null;
         if (isset($matches[10])) {
             $off = strtolower($matches[10]);
         }
         return ap_Utils::ApplyOffsetForDate($_dt, $off, $zone);
     }
     return time();
 }