public function setDate($date)
    {
        if (!is_numeric($date)) {
            if ($date instanceof DateTime)
                $date = $date->getTimestamp();
            else {
                $date = strtotime($date);

                if ($date === FALSE)
                    throw new \InvalidArgumentException('The given date string was not parseable.');
            }
        } elseif ($date < 0)
            throw new \InvalidArgumentException('The given date is not an UNIX timestamp.');

        if ($this->version == Feed::ATOM) {
            $tag    = 'updated';
            $value  = date(\DATE_ATOM, $date);
        } elseif ($this->version == Feed::RSS2) {
            $tag    = 'pubDate';
            $value  = date(\DATE_RSS, $date);
        } else {
            $tag    = 'dc:date';
            $value  = date("Y-m-d", $date);
        }

        return $this->addElement($tag, $value);
    }
public function setDate($date)
    {
        if (!is_numeric($date)) {
            if ($date instanceof DateTime)
                $date = $date->getTimestamp();
            else {
                $date = strtotime($date);

                if ($date === FALSE)
                    throw new \InvalidArgumentException('The given date string was not parseable.');
            }
        } elseif ($date < 0)
            throw new \InvalidArgumentException('The given date is not an UNIX timestamp.');

        if ($this->version == Feed::ATOM) {
            $tag    = 'updated';
            $value  = date(\DATE_ATOM, $date);
        } elseif ($this->version == Feed::RSS2) {
            $tag    = 'pubDate';
            $value  = date(\DATE_RSS, $date);
        } else {
            $tag    = 'dc:date';
            $value  = date("Y-m-d", $date);
        }

        return $this->addElement($tag, $value);
    }
public function setDate ( $ date ) { if ( ! is_numeric ( $ date ) ) { if ( $ date instanceof DateTime ) $ date = $ date -> getTimestamp ( ) ; else { $ date = strtotime ( $ date ) ; if ( $ date === FALSE ) throw new \ InvalidArgumentException ( 'The given date string was not parseable.' ) ; } } elseif ( $ date < 0 ) throw new \ InvalidArgumentException ( 'The given date is not an UNIX timestamp.' ) ; if ( $ this -> version == Feed :: ATOM ) { $ tag = 'updated' ; $ value = date ( \ DATE_ATOM , $ date ) ; } elseif ( $ this -> version == Feed :: RSS2 ) { $ tag = 'pubDate' ; $ value = date ( \ DATE_RSS , $ date ) ; } else { $ tag = 'dc:date' ; $ value = date ( "Y-m-d" , $ date ) ; } return $ this -> addElement ( $ tag , $ value ) ; }
Set the 'date' element of the feed item.

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.

@access   public
@param    DateTime|int|string $date Date which should be used.
@return   self
@throws   \InvalidArgumentException if the given date was not parseable.
Set the date element of the feed item .