public function SearchApiSolrBackend::formatDate in Search API Solr 4.x
Same name and namespace in other branches
- 8.3 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::formatDate()
- 8 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::formatDate()
- 8.2 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
int|string $input: The date to format (timestamp or string).
Return value
bool|string The formatted date as string or FALSE in case of invalid input.
3 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.
- SearchApiSolrBackend::getDocuments in src/
Plugin/ search_api/ backend/ SearchApiSolrBackend.php
File
- src/
Plugin/ search_api/ backend/ SearchApiSolrBackend.php, line 3342
Class
- SearchApiSolrBackend
- Apache Solr backend for search api.
Namespace
Drupal\search_api_solr\Plugin\search_api\backendCode
public function formatDate($input) {
try {
$input = is_numeric($input) ? (int) $input : new \DateTime($input, timezone_open(DateTimeItemInterface::STORAGE_TIMEZONE));
} catch (\Exception $e) {
return FALSE;
}
return $this->queryHelper
->formatDate($input);
}