You are here

public function Sql::getDateFormat in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::getDateFormat()

Creates cross-database date formatting.

Parameters

string $field: An appropriate query expression pointing to the date field.

string $format: A format string for the result, like 'Y-m-d H:i:s'.

bool $string_date: For certain databases, date format functions vary depending on string or numeric storage.

Return value

string A string representing the field formatted as a date in the format specified by $format.

Overrides QueryPluginBase::getDateFormat

File

core/modules/views/src/Plugin/views/query/Sql.php, line 1844

Class

Sql
Views query plugin for an SQL query.

Namespace

Drupal\views\Plugin\views\query

Code

public function getDateFormat($field, $format, $string_date = FALSE) {
  return $this->dateSql
    ->getDateFormat($field, $format);
}