function DateTimeIso8601::getDateTime
Same name in other branches
- 9 core/lib/Drupal/Core/TypedData/Plugin/DataType/DateTimeIso8601.php \Drupal\Core\TypedData\Plugin\DataType\DateTimeIso8601::getDateTime()
- 10 core/lib/Drupal/Core/TypedData/Plugin/DataType/DateTimeIso8601.php \Drupal\Core\TypedData\Plugin\DataType\DateTimeIso8601::getDateTime()
- 11.x core/lib/Drupal/Core/TypedData/Plugin/DataType/DateTimeIso8601.php \Drupal\Core\TypedData\Plugin\DataType\DateTimeIso8601::getDateTime()
Overrides DateTimeInterface::getDateTime
File
-
core/
lib/ Drupal/ Core/ TypedData/ Plugin/ DataType/ DateTimeIso8601.php, line 23
Class
- DateTimeIso8601
- A data type for ISO 8601 date strings.
Namespace
Drupal\Core\TypedData\Plugin\DataTypeCode
public function getDateTime() {
if ($this->value) {
if (is_array($this->value)) {
// Data of this type must always be stored in UTC.
$datetime = DrupalDateTime::createFromArray($this->value, 'UTC');
}
else {
// Data of this type must always be stored in UTC.
$datetime = new DrupalDateTime($this->value, 'UTC');
}
return $datetime;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.