/** * @param string $strDate * @return int */ function GetTimeFromString($strDate) { $dt = time() - CDateTime::GetServerTimeZoneOffset(); $matches = array(); $zone = null; $off = null; $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 = ConvertUtils::GetMonthIndex(strtolower($matches[4])); if ($month == -1) { $month = 1; } $day = $matches[3]; $hour = $matches[6]; $minute = $matches[7]; $second = $matches[8]; $dt = ConvertUtils::GmtMkTime($hour, $minute, $second, $month, $day, $year); if (isset($matches[13])) { $zone = strtolower($matches[13]); } if (isset($matches[10])) { $off = strtolower($matches[10]); } } $dt = ConvertUtils::ApplyOffsetForDate($dt, $off, $zone); return $dt; }