You are here

protected function SearchApiDate::getTimestamp in Search API 8

Converts a value to a timestamp, if it isn't one already.

Parameters

string|int $value: The value to convert. Either a timestamp, or a date/time string as recognized by strtotime().

Return value

int|false The parsed timestamp, or FALSE if an illegal string was passed.

1 call to SearchApiDate::getTimestamp()
SearchApiDate::title in src/Plugin/views/argument/SearchApiDate.php
Get the title this argument will assign the view, given the argument.

File

src/Plugin/views/argument/SearchApiDate.php, line 148

Class

SearchApiDate
Defines a contextual filter for conditions on date fields.

Namespace

Drupal\search_api\Plugin\views\argument

Code

protected function getTimestamp($value) {
  if (is_numeric($value)) {
    return (int) $value;
  }
  return strtotime($value);
}