function DateTimeIso8601::setDateTime

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

Overrides DateTimeInterface::setDateTime

File

core/lib/Drupal/Core/TypedData/Plugin/DataType/DateTimeIso8601.php, line 40

Class

DateTimeIso8601
A data type for ISO 8601 date strings.

Namespace

Drupal\Core\TypedData\Plugin\DataType

Code

public function setDateTime(DrupalDateTime $dateTime, $notify = TRUE) {
    $this->value = $dateTime->format('c');
    // 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.