You are here

public function SearchApiViewsHandlerArgumentDate::getTimestamp in Search API 7

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 SearchApiViewsHandlerArgumentDate::getTimestamp()
SearchApiViewsHandlerArgumentDate::title in contrib/search_api_views/includes/handler_argument_date.inc
Computes the title this argument will assign the view, given the argument.

File

contrib/search_api_views/includes/handler_argument_date.inc, line 75
Contains the SearchApiViewsHandlerArgumentDate class.

Class

SearchApiViewsHandlerArgumentDate
Defines a contextual filter searching for a date or date range.

Code

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