WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

SimplePie_Parse_Date::date_rfc2822() public WP 1.0

Parse RFC2822's date format

{} Это метод класса: SimplePie_Parse_Date{}

Хуков нет.

Возвращает

Число. Timestamp

Использование

$SimplePie_Parse_Date = new SimplePie_Parse_Date();
$SimplePie_Parse_Date->date_rfc2822( $date );

Код SimplePie_Parse_Date::date_rfc2822() WP 5.5.3

<?php
public function date_rfc2822($date)
{
	static $pcre;
	if (!$pcre)
	{
		$wsp = '[\x09\x20]';
		$fws = '(?:' . $wsp . '+|' . $wsp . '*(?:\x0D\x0A' . $wsp . '+)+)';
		$optional_fws = $fws . '?';
		$day_name = $this->day_pcre;
		$month = $this->month_pcre;
		$day = '([0-9]{1,2})';
		$hour = $minute = $second = '([0-9]{2})';
		$year = '([0-9]{2,4})';
		$num_zone = '([+\-])([0-9]{2})([0-9]{2})';
		$character_zone = '([A-Z]{1,5})';
		$zone = '(?:' . $num_zone . '|' . $character_zone . ')';
		$pcre = '/(?:' . $optional_fws . $day_name . $optional_fws . ',)?' . $optional_fws . $day . $fws . $month . $fws . $year . $fws . $hour . $optional_fws . ':' . $optional_fws . $minute . '(?:' . $optional_fws . ':' . $optional_fws . $second . ')?' . $fws . $zone . '/i';
	}
	if (preg_match($pcre, $this->remove_rfc2822_comments($date), $match))
	{
		/*
		Capturing subpatterns:
		1: Day name
		2: Day
		3: Month
		4: Year
		5: Hour
		6: Minute
		7: Second
		8: Timezone ±
		9: Timezone hours
		10: Timezone minutes
		11: Alphabetic timezone
		*/

		// Find the month number
		$month = $this->month[strtolower($match[3])];

		// Numeric timezone
		if ($match[8] !== '')
		{
			$timezone = $match[9] * 3600;
			$timezone += $match[10] * 60;
			if ($match[8] === '-')
			{
				$timezone = 0 - $timezone;
			}
		}
		// Character timezone
		elseif (isset($this->timezone[strtoupper($match[11])]))
		{
			$timezone = $this->timezone[strtoupper($match[11])];
		}
		// Assume everything else to be -0000
		else
		{
			$timezone = 0;
		}

		// Deal with 2/3 digit years
		if ($match[4] < 50)
		{
			$match[4] += 2000;
		}
		elseif ($match[4] < 1000)
		{
			$match[4] += 1900;
		}

		// Second is optional, if it is empty set it to zero
		if ($match[7] !== '')
		{
			$second = $match[7];
		}
		else
		{
			$second = 0;
		}

		return gmmktime($match[5], $match[6], $second, $month, $match[2], $match[4]) - $timezone;
	}

	return false;
}