You are here

public function Sql::setupTimezone in Drupal 9

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

Set the database to the current user timezone.

Return value

string The current timezone as returned by date_default_timezone_get().

Overrides QueryPluginBase::setupTimezone

File

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

Class

Sql
Views query plugin for an SQL query.

Namespace

Drupal\views\Plugin\views\query

Code

public function setupTimezone() {

  // Set the database timezone offset.
  static $already_set = FALSE;
  if (!$already_set) {
    $this->dateSql
      ->setTimezoneOffset('+00:00');
    $already_set = TRUE;
  }
  return parent::setupTimezone();
}