You are here

public function Timestamp::getDateTime in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/TypedData/Plugin/DataType/Timestamp.php \Drupal\Core\TypedData\Plugin\DataType\Timestamp::getDateTime()

Returns the date time object.

Return value

\Drupal\Core\Datetime\DrupalDateTime|null A date object or NULL if there is no date.

Overrides DateTimeInterface::getDateTime

File

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

Class

Timestamp
The timestamp data type.

Namespace

Drupal\Core\TypedData\Plugin\DataType

Code

public function getDateTime() {
  if (isset($this->value)) {
    return DrupalDateTime::createFromTimestamp($this->value);
  }
}