You are here

function date_sql_handler::get_offset in Date 7

Same name and namespace in other branches
  1. 5.2 date_api_sql.inc \date_sql_handler::get_offset()
  2. 6.2 date_api_sql.inc \date_sql_handler::get_offset()
  3. 6 date_api_sql.inc \date_sql_handler::get_offset()
  4. 7.3 date_api/date_api_sql.inc \date_sql_handler::get_offset()
  5. 7.2 date_api/date_api_sql.inc \date_sql_handler::get_offset()

Return timezone offset for the date being processed.

1 call to date_sql_handler::get_offset()
date_sql_handler::sql_tz in date_api/date_api_sql.inc
Select a date value from the database, adjusting the value for the timezone.

File

date_api/date_api_sql.inc, line 145
SQL helper for Date API.

Class

date_sql_handler
A class to manipulate date SQL.

Code

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