How to localize the dates in an RSS feed?



Hello, I have a question about your RSS Reader which works fine by the way. I've seen a post about this on the forum but i still couldn't figure it out. I am from Holland so everything is dutch, but the date is shown like this: Sat, 15 Sep 2012 00:00:00 GMT How can i change this? With the PHP Date format, but where do i put this in your rsslib file? Regards, Rick.


Hello Actually the date is a string, extracted from the tag. The format is that is given by the RSS generator, you can change it, there are surely on the Web some script to do that. And you can change it in the RSS_tags function:
$y["date"] = convert($date);
The convert function must be added. Sincerely The webmaster
2013-04-11 18:58:01


My work to answer to a recent question brings addtional infos about the issue. At first you have to remove the leading day of week string:
$phpdate = substr($y['date'],5);
or depending the function where you put the code:
$phpdate = substr($date,5);
And then you convert the date to a timestamp:
$timestamp = strtotime($phpdate);
Then you can display the date in any format and any location with the right function:
setlocale(LC_TIME, "nl_NL");
$pubdate = strftime("%V,%G,%Y", $timestamp);
$pubdate is now displayed rather than $y['date']; You can replace "nl_NL" by the localization for any country. So the convert function could look like:
function convert($d)
	$phpdate = substr($d, 5);
	$timestamp = strtotime($phpdate);
	setlocale(LC_TIME, "nl_NL");
	return strftime("%V,%G,%Y", $timestamp);