function PostgresqlDateSql::getDateField

Same name and namespace in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/query/PostgresqlDateSql.php \Drupal\views\Plugin\views\query\PostgresqlDateSql::getDateField()
  2. 10 core/modules/views/src/Plugin/views/query/PostgresqlDateSql.php \Drupal\views\Plugin\views\query\PostgresqlDateSql::getDateField()
  3. 11.x core/modules/views/src/Plugin/views/query/PostgresqlDateSql.php \Drupal\views\Plugin\views\query\PostgresqlDateSql::getDateField()

Overrides DateSqlInterface::getDateField

File

core/modules/views/src/Plugin/views/query/PostgresqlDateSql.php, line 66

Class

PostgresqlDateSql
PostgreSQL-specific date handling.

Namespace

Drupal\views\Plugin\views\query

Code

public function getDateField($field, $string_date) {
    if ($string_date) {
        // Ensures compatibility with field offset operation below.
        return "TO_TIMESTAMP({$field}, 'YYYY-MM-DD\"T\"HH24:MI:SS')";
    }
    return "TO_TIMESTAMP({$field})";
}

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