public function setDate($date)
    {
        if ($this->version == Feed::RSS1)
            throw new InvalidOperationException('The publication date is not supported in RSS1 feeds.');

        // The feeds have different date formats.
        $format = $this->version == Feed::ATOM ? \DATE_ATOM : \DATE_RSS;

        if ($date instanceof DateTime)
            $date = $date->format($format);
        else if(is_numeric($date) && $date >= 0)
            $date = date($format, $date);
        else if (is_string($date))
        {
            $timestamp = strtotime($date);
            if ($timestamp === FALSE)
                throw new \InvalidArgumentException('The given date was not parseable.');

            $date = date($format, $timestamp);
        }
        else
            throw new \InvalidArgumentException('The given date is not an instance of DateTime, a UNIX timestamp or a date string.');

        if ($this->version == Feed::ATOM)
            $this->setChannelElement('updated', $date);
        else
            $this->setChannelElement('lastBuildDate', $date);

        return $this;
    }
public function setDate($date)
    {
        if ($this->version == Feed::RSS1)
            throw new InvalidOperationException('The publication date is not supported in RSS1 feeds.');

        // The feeds have different date formats.
        $format = $this->version == Feed::ATOM ? \DATE_ATOM : \DATE_RSS;

        if ($date instanceof DateTime)
            $date = $date->format($format);
        else if(is_numeric($date) && $date >= 0)
            $date = date($format, $date);
        else if (is_string($date))
        {
            $timestamp = strtotime($date);
            if ($timestamp === FALSE)
                throw new \InvalidArgumentException('The given date was not parseable.');

            $date = date($format, $timestamp);
        }
        else
            throw new \InvalidArgumentException('The given date is not an instance of DateTime, a UNIX timestamp or a date string.');

        if ($this->version == Feed::ATOM)
            $this->setChannelElement('updated', $date);
        else
            $this->setChannelElement('lastBuildDate', $date);

        return $this;
    }
public function setDate ( $ date ) { if ( $ this -> version == Feed :: RSS1 ) throw new InvalidOperationException ( 'The publication date is not supported in RSS1 feeds.' ) ; // The feeds have different date formats. $ format = $ this -> version == Feed :: ATOM ? \ DATE_ATOM : \ DATE_RSS ; if ( $ date instanceof DateTime ) $ date = $ date -> format ( $ format ) ; else if ( is_numeric ( $ date ) && $ date >= 0 ) $ date = date ( $ format , $ date ) ; else if ( is_string ( $ date ) ) { $ timestamp = strtotime ( $ date ) ; if ( $ timestamp === FALSE ) throw new \ InvalidArgumentException ( 'The given date was not parseable.' ) ; $ date = date ( $ format , $ timestamp ) ; } else throw new \ InvalidArgumentException ( 'The given date is not an instance of DateTime, a UNIX timestamp or a date string.' ) ; if ( $ this -> version == Feed :: ATOM ) $ this -> setChannelElement ( 'updated' , $ date ) ; else $ this -> setChannelElement ( 'lastBuildDate' , $ date ) ; return $ this ; }
Set the date when the feed was lastly updated.

This adds the 'updated' element to the feed. The value of the date parameter
can be either an instance of the DateTime class, an integer containing a UNIX
timestamp or a string which is parseable by PHP's 'strtotime' function.

Not supported in RSS1 feeds.

@access   public
@param    DateTime|int|string  Date which should be used.
@return   self
@throws   \InvalidArgumentException if the given date is not an instance of DateTime, a UNIX timestamp or a date string.
@throws   InvalidOperationException if this method is called on an RSS1 feed.
Set the date when the feed was lastly updated .