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