You are here

protected function SearchApiSolrBackend::formatDate in Search API Solr 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::formatDate()
  2. 8.2 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::formatDate()
  3. 4.x src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::formatDate()

Tries to format given date with solarium query helper.

Parameters

mixed $input:

Return value

bool|string

2 calls to SearchApiSolrBackend::formatDate()
SearchApiSolrBackend::addIndexField in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Helper method for indexing.
SearchApiSolrBackend::formatFilterValue in src/Plugin/search_api/backend/SearchApiSolrBackend.php
Format a value for filtering on a field of a specific type.

File

src/Plugin/search_api/backend/SearchApiSolrBackend.php, line 1947

Class

SearchApiSolrBackend
Apache Solr backend for search api.

Namespace

Drupal\search_api_solr\Plugin\search_api\backend

Code

protected function formatDate($input) {
  $input = is_numeric($input) ? (int) $input : new \DateTime($input, timezone_open(DateTimeItemInterface::STORAGE_TIMEZONE));
  return $this
    ->getSolrConnector()
    ->getQueryHelper()
    ->formatDate($input);
}