protected function DateTimePlus::constructFromTimestamp

Creates a date object from timestamp input.

The timezone of a timestamp is always UTC. The timezone for a timestamp indicates the timezone used by the format() method.

1 call to DateTimePlus::constructFromTimestamp()
DateTimePlus::__construct in drupal/core/lib/Drupal/Component/Datetime/DateTimePlus.php
Constructs a date object set to a requested date and timezone.

File

drupal/core/lib/Drupal/Component/Datetime/DateTimePlus.php, line 330
Definition of Drupal\Component\Datetime\DateTimePlus

Class

DateTimePlus
Extends DateTime().

Namespace

Drupal\Component\Datetime

Code

protected function constructFromTimestamp() {
  try {
    parent::__construct('', $this->inputTimeZoneAdjusted);
    $this
      ->setTimestamp($this->inputTimeAdjusted);
  } catch (\Exception $e) {
    $this->errors[] = $e
      ->getMessage();
  }
}