SimplePie_Parse_Date::date_rfc850 PHP Method

date_rfc850() public method

Parse RFC850's date format
public date_rfc850 ( $date ) : integer
return integer Timestamp
    public function date_rfc850($date)
    {
        static $pcre;
        if (!$pcre) {
            $space = '[\\x09\\x20]+';
            $day_name = $this->day_pcre;
            $month = $this->month_pcre;
            $day = '([0-9]{1,2})';
            $year = $hour = $minute = $second = '([0-9]{2})';
            $zone = '([A-Z]{1,5})';
            $pcre = '/^' . $day_name . ',' . $space . $day . '-' . $month . '-' . $year . $space . $hour . ':' . $minute . ':' . $second . $space . $zone . '$/i';
        }
        if (preg_match($pcre, $date, $match)) {
            /*
            Capturing subpatterns:
            1: Day name
            2: Day
            3: Month
            4: Year
            5: Hour
            6: Minute
            7: Second
            8: Timezone
            */
            // Month
            $month = $this->month[strtolower($match[3])];
            // Character timezone
            if (isset($this->timezone[strtoupper($match[8])])) {
                $timezone = $this->timezone[strtoupper($match[8])];
            } else {
                $timezone = 0;
            }
            // Deal with 2 digit year
            if ($match[4] < 50) {
                $match[4] += 2000;
            } else {
                $match[4] += 1900;
            }
            return gmmktime($match[5], $match[6], $match[7], $month, $match[2], $match[4]) - $timezone;
        } else {
            return false;
        }
    }