function HandlerBase::getDateFormat

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::getDateFormat()
  2. 8.9.x core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::getDateFormat()
  3. 10 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::getDateFormat()

Creates cross-database SQL date formatting.

Parameters

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

Return value

string An appropriate SQL string for the DB type and field type.

2 calls to HandlerBase::getDateFormat()
Date::getFormula in core/modules/views/src/Plugin/views/argument/Date.php
Date::query in core/modules/views/src/Plugin/views/sort/Date.php
Called to add the sort to a query.
2 methods override HandlerBase::getDateFormat()
Date::getDateFormat in core/modules/datetime/src/Plugin/views/sort/Date.php
Overridden in order to pass in the string date flag.
Date::getDateFormat in core/modules/datetime/src/Plugin/views/argument/Date.php
Creates cross-database SQL date formatting.

File

core/modules/views/src/Plugin/views/HandlerBase.php, line 721

Class

HandlerBase
Base class for Views handler plugins.

Namespace

Drupal\views\Plugin\views

Code

public function getDateFormat($format) {
    return $this->query
        ->getDateFormat($this->getDateField(), $format);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.