I get a RSS开发者_如何学JAVA and I manage it with PHP: I parse it, and I get the date value with :
$data_feed=$item[pubdate];
If I print this date, I get for example :
Wed, 05 Oct 2011 00:00:00 PST
I know that on RSS there are many date format, such as PST, EST, GMT, +0200 and son on.
How can I Parse on PHP any kind of date format from a RSS? As example, I'd like to have always the format DD-MM-YYYY.
strtotime
will handle most common formats.
From there, you can use strftime
to display the format you'd like.
This simple command works for me:
$date = date_create_from_format(DateTime::RSS, $string);
精彩评论