You are here

public function Deleted::setWhen in Zircon Profile 8.0

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

Set when

Parameters

null|string|DateTime $date:

Return value

Deleted

Throws

Exception\InvalidArgumentException

File

vendor/zendframework/zend-feed/src/Writer/Deleted.php, line 139

Class

Deleted

Namespace

Zend\Feed\Writer

Code

public function setWhen($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['when'] = $date;
  return $this;
}