I hope this is quick for someone who knows, but I had a problem trying to get the correct date and time format for the RSS feed in the Zend framework project and display all available resources;
php datetime The only resource I cannot fully understand is the Zend documentation, as I am not quite sure how to properly call the static class to which they refer. Zend Date_time . Also the DB field is a type of date and time ...
I got to all my data in the feed, except for publishing pubDate in XML format. Since the format is not recognized correctly, the feed simply splashes out the current date for each message. Heres, as I understand it ...
public function rssAction()
{
$this->_helper->layout->setLayout('xmllayout');
$model = new Default_Model_News;
$newsitems = $model->fetchAll();
$date = date("D\, j M Y G:i:s");
$feedArray = array (
'title' => "Postgoldforcash News Feed",
'description' => "Postgoldforcash News Feed",
'link' => "http://www.postgoldforcash.com",
'language' => 'en-EN',
'charset' => 'utf-8',
'docs' => "Postgoldforcash News",
'pubDate' => $date,
'entries' => array()
);
foreach ( $newsitems as $article ) {
$fDate = date_format(new DateTime($article->publishDate), "r");
$feedArray['entries'][] = array (
'title' => $article->title,
'link' => $article->url."/",
'guid' => $article->title,
'description' => $article->content,
'pubDate' => $fDate
);
}
$feed = Zend_Feed::importArray($feedArray, 'rss');
$feed->send();
}
, :
date_format(new DateTime($article->publishDate), "D\, j M Y G:i:s");
strftime ($article->publishDate, "%a, %d %b %Y %H:%M:%S %z") ;
gmdate(DATE_RSS, strtotime($article->publishDate));
!