1 date_sql_handler.inc public date_sql_handler::get_offset($comp_date = NULL)

Return timezone offset for the date being processed.

File

core/modules/date/views/date_sql_handler.inc, line 105
SQL helper for Date API.

Class

date_sql_handler
A class to manipulate date SQL.

Code

public function get_offset($comp_date = NULL) {
  if (!empty($this->db_timezone) && !empty($this->local_timezone)) {
    if ($this->db_timezone != $this->local_timezone) {
      if (empty($comp_date)) {
        $comp_date = date_now($this->db_timezone);
      }
      $comp_date->setTimezone(timezone_open($this->local_timezone));
      return date_offset_get($comp_date);
    }
  }
  return 0;
}