You are here

function _parser_common_syndication_parse_date in Feeds Atom 6

Same name and namespace in other branches
  1. 7 libraries/atomrdf_parser.inc \_parser_common_syndication_parse_date()

Parse a date comes from a feed.

Parameters

$date_string: The date string in various formats.

Return value

The timestamp of the string or the current time if can't be parsed

1 call to _parser_common_syndication_parse_date()
atomrdf_parse in libraries/atomrdf_parser.inc
Parse AtomRDF format - for example:

File

libraries/atomrdf_parser.inc, line 431
Contains the atomrd parsing functions.

Code

function _parser_common_syndication_parse_date($date_str) {

  // PHP < 5.3 doesn't like the GMT- notation for parsing timezones.
  $date_str = str_replace("GMT-", "-", $date_str);
  $date_str = str_replace("GMT+", "+", $date_str);
  $parsed_date = strtotime($date_str);
  if ($parsed_date === FALSE || $parsed_date == -1) {
    $parsed_date = _parser_common_syndication_parse_w3cdtf($date_str);
  }
  return $parsed_date === FALSE ? time() : $parsed_date;
}