You are here

function date_sql_handler::get_offset in Date 5.2

Same name and namespace in other branches
  1. 6.2 date_api_sql.inc \date_sql_handler::get_offset()
  2. 6 date_api_sql.inc \date_sql_handler::get_offset()
  3. 7.3 date_api/date_api_sql.inc \date_sql_handler::get_offset()
  4. 7 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_sql.inc
Select a date value from the database, adjusting the value for the timezone.

File

./date_api_sql.inc, line 122

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_timezone_set($date, timezone_open($this->local_timezone));
      return date_offset_get($date);
    }
  }
  return 0;
}