You are here

function _views_get_timezone in Views (for Drupal 7) 5

Figure out what timezone we're in; needed for some date manipulations.

6 calls to _views_get_timezone()
views_handler_arg_fulldate in modules/views_node.inc
views_handler_arg_month in modules/views_node.inc
views_handler_arg_monthyear in modules/views_node.inc
views_handler_arg_week in modules/views_node.inc
views_handler_arg_year in modules/views_node.inc

... See full list

File

./views.module, line 683

Code

function _views_get_timezone() {
  global $user;
  if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) {
    $timezone = $user->timezone;
  }
  else {
    $timezone = variable_get('date_default_timezone', 0);
  }

  // set up the database timezone
  if (in_array($GLOBALS['db_type'], array(
    'mysql',
    'mysqli',
  ))) {
    static $already_set = false;
    if (!$already_set) {
      if ($GLOBALS['db_type'] == 'mysqli' || version_compare(mysql_get_server_info(), '4.1.3', '>=')) {
        db_query("SET @@session.time_zone = '+00:00'");
      }
      $already_set = true;
    }
  }
  return $timezone;
}