You are here

public function AbstractFeed::setLastBuildDate in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-feed/src/Writer/AbstractFeed.php \Zend\Feed\Writer\AbstractFeed::setLastBuildDate()

Set the feed last-build date. Ignored for Atom 1.0.

Parameters

null|int|DateTime:

Return value

AbstractFeed

Throws

Exception\InvalidArgumentException

File

vendor/zendframework/zend-feed/src/Writer/AbstractFeed.php, line 176

Class

AbstractFeed

Namespace

Zend\Feed\Writer

Code

public function setLastBuildDate($date = null) {
  if ($date === null) {
    $date = new DateTime();
  }
  elseif (is_int($date)) {
    $date = new DateTime('@' . $date);
  }
  elseif (!$date instanceof DateTime) {
    throw new Exception\InvalidArgumentException('Invalid DateTime object or UNIX Timestamp' . ' passed as parameter');
  }
  $this->data['lastBuildDate'] = $date;
  return $this;
}