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