public function DateTimePlus::inputIsTimestamp

Checks whether input time seems to be a timestamp.

Providing an input format will prevent ISO values without separators from being mis-interpreted as timestamps. Providing a format can also avoid interpreting a value like '2010' with a format of 'Y' as a timestamp. The 'U' format indicates this is a timestamp.

Return value

boolean TRUE if the input time is a timestamp.

1 call to DateTimePlus::inputIsTimestamp()
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 320
Definition of Drupal\Component\Datetime\DateTimePlus

Class

DateTimePlus
Extends DateTime().

Namespace

Drupal\Component\Datetime

Code

public function inputIsTimestamp() {
  return is_numeric($this->inputTimeAdjusted) && (empty($this->inputFormatAdjusted) || $this->inputFormatAdjusted == 'U');
}