Discussion board

How to find RSS feed dates

?
2012-09-18

Rick

Hi, I have a question about a perfectly working RSS player. I saw a post about this on the forum, but still does not come to the expected result.
I live in Holland, so everything is Dutch, but the date is displayed as: Sat, September 15, 2012, 00:00:00 GMT. How can I change that? With PHP date format, but where do I put it in the rsslib file? Hey, Rick.
2012-09-18

scriptol

Hi.
The date is actually a string extracted from the pubdate tag. The format is the one that gives the RSS generator, you can change it, there is probably some kind of script for this on the Web.
This is what you can change in the RSS_tags function:
$y["date"] = convert($date);
The convert element must be added.
Sincerely,
webmaster
2013-04-11 18:58:01

Scriptol

My work on answering a recent question provides additional information on this issue.
First you need to delete the day of the week at the beginning:
$phpdate = substr($y['date'],5);
or depending on the function you want to put the code in:
$phpdate = substr($date,5);
Then you convert the date to a timestamp:
$timestamp = strtotime($phpdate);
Finally, you can show the date in any format and any location with the appropriate function:
setlocale(LC_TIME, "nl_NL");
$pubdate = strftime("%V,%G,%Y", $timestamp);
$ pubdate should now appear instead of $ y ['date']; You can re-read the "nl_NL" for the localization of any country (for France it would be fr_FR).
Thus, the convert function may look like this:
function convert($d)
{
  $phpdate = substr($d, 5);
  $timestamp = strtotime($phpdate);
  setlocale(LC_TIME, "nl_NL");
  return strftime("%V,%G,%Y", $timestamp);
}