function Timestamp::setDateTime

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/TypedData/Plugin/DataType/Timestamp.php \Drupal\Core\TypedData\Plugin\DataType\Timestamp::setDateTime()
  2. 8.9.x core/lib/Drupal/Core/TypedData/Plugin/DataType/Timestamp.php \Drupal\Core\TypedData\Plugin\DataType\Timestamp::setDateTime()
  3. 10 core/lib/Drupal/Core/TypedData/Plugin/DataType/Timestamp.php \Drupal\Core\TypedData\Plugin\DataType\Timestamp::setDateTime()

Overrides DateTimeInterface::setDateTime

File

core/lib/Drupal/Core/TypedData/Plugin/DataType/Timestamp.php, line 38

Class

Timestamp
The timestamp data type.

Namespace

Drupal\Core\TypedData\Plugin\DataType

Code

public function setDateTime(DrupalDateTime $dateTime, $notify = TRUE) {
    $this->value = $dateTime->getTimestamp();
    // Notify the parent of any changes.
    if ($notify && isset($this->parent)) {
        $this->parent
            ->onChange($this->name);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.