Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4007416
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:37:48+00:00 2026-05-20T08:37:48+00:00

Hopefully this is a quick one for someone in the knowledge but i am

  • 0

Hopefully this is a quick one for someone in the knowledge but i am having a problem trying to get the correct datetime format for an RSS feed in a Zend framework project and exhasuted all avaliable resources;
php datetime The only resource I cant fully comprehend is the Zend documentation as Im not quite sure how to correctly call the static class they refer too Zend Date_time. Also the DB field is a datetime type…

I have got as far as getting all my data into the feed with the exception of the pubDate out putting in XML format. As the format is not recognised correctly the feed is just spitting out the current date for each post. Heres as far as I got…

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."/", // for some reason i have to add a blank space or '/' in otherwise it breaks...
                    'guid'            =>    $article->title,
                    'description'     =>    $article->content,
                    'pubDate'         =>    $fDate
            );       
    }
    $feed = Zend_Feed::importArray($feedArray, 'rss');
    $feed->send();
}

I have tried all the other ways of getting the correct formatting including;

 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));

Any pointers would be great!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T08:37:48+00:00Added an answer on May 20, 2026 at 8:37 am

    pubDate or published is an optional field and its not required. So i would comment that out.

    I would add ‘lastUpdate’ => strtotime($article->publishDate) to the $feedArray. Note that the Zend RSS compiler will then do gmdate to this to format it.

    And instead of using import Array, use importBuilder.

    Please refer to: http://framework.zend.com/manual/en/zend.feed.importing.html for any extra information.

    Its also best practice to only display the latest feeds (in this case ive done 10)

    So the code should read:

        public function rssAction() {
    
        $this->_helper->layout->setLayout('xmllayout');
    
        $model = new Default_Model_News;
        $newsitems = $model->fetchAll();
        $date = date("YYYY-MM-dd HH:mm:ss");
    
        $feedArray = array(
            'title' => "Postgoldforcash News Feed",
            'description' => "Postgoldforcash News Feed",
            'link' => "http://www.postgoldforcash.com",
            'language' => 'en-EN',
            'charset' => 'utf-8',
            'docs' => "Postgoldforcash News",
            'generator' => 'Zend Framework Zend_Feed',
            'entries' => array()
        );
    
        $i = 0;
        foreach ($newsitems as $article) {
            $i++;
            if ($i > 10)
                break;
            $feedArray['entries'][] = array(
                'title' => html_entity_decode($article->title),
                'link' => $article->url ."/",
                'guid' => $article->url,
                'description' => strip_tags($article->content),
                'lastUpdate' => strtotime($article->publishDate)
    
            );
        }
        $feed = Zend_Feed::importBuilder(new Zend_Feed_Builder($feedArray), 'rss');
        $feed->send();
    }
    

    Give it a go.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hopefully this is a quick one for you WPF experts out here. Is there
Hopefully this is just quick fix, but when I execute any select query, such
Quick one hopefully; brain has gone blank. Is it possible / practical to have
Hopefully this is a quick and easy question to answer. I have a MySQL
Just a quick regex question...hopefully I have a string that looks something like this:
This might seem like a duplicate question, but I can't find any information on
I have a hopefully quick question: Is it possible to delay execution of ShellExecute
Quick question (hopefully), how do I properly call the win32 function CreateProfile() from C#
I'm trying to use Entity Framework for my model/data access, and running into speed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.