You are here

public function SqlsrvDateSql::setFieldTimezoneOffset in Drupal driver for SQL Server and SQL Azure 8

Same name and namespace in other branches
  1. 4.2.x src/Plugin/views/query/SqlsrvDateSql.php \Drupal\sqlsrv\Plugin\views\query\SqlsrvDateSql::setFieldTimezoneOffset()
  2. 3.0.x src/Plugin/views/query/SqlsrvDateSql.php \Drupal\sqlsrv\Plugin\views\query\SqlsrvDateSql::setFieldTimezoneOffset()
  3. 3.1.x src/Plugin/views/query/SqlsrvDateSql.php \Drupal\sqlsrv\Plugin\views\query\SqlsrvDateSql::setFieldTimezoneOffset()
  4. 4.0.x src/Plugin/views/query/SqlsrvDateSql.php \Drupal\sqlsrv\Plugin\views\query\SqlsrvDateSql::setFieldTimezoneOffset()
  5. 4.1.x src/Plugin/views/query/SqlsrvDateSql.php \Drupal\sqlsrv\Plugin\views\query\SqlsrvDateSql::setFieldTimezoneOffset()

Applies the given offset to the given field.

Parameters

string &$field: The date field in a string format.

int $offset: The timezone offset in seconds.

Overrides DateSqlInterface::setFieldTimezoneOffset

File

src/Plugin/views/query/SqlsrvDateSql.php, line 99

Class

SqlsrvDateSql
MSSQL-specific date handling.

Namespace

Drupal\sqlsrv\Plugin\views\query

Code

public function setFieldTimezoneOffset(&$field, $offset) {
  if (!empty($offset)) {
    $field = "DATEADD(second, {$offset}, {$field})";
  }
}