function date_views_set_timezone in Date 8
Same name and namespace in other branches
- 5.2 date/date_views.inc \date_views_set_timezone()
- 6.2 includes/date_api.views.inc \date_views_set_timezone()
- 7.3 date_views/includes/date_views.views.inc \date_views_set_timezone()
- 7 date_views/includes/date_views.views.inc \date_views_set_timezone()
- 7.2 date_views/includes/date_views.views.inc \date_views_set_timezone()
Central function for setting up the right timezone values in the SQL date handler.
The date handler will use this information to decide if the database value needs a timezone conversion.
In Views, we will always be comparing to a local date value, so the goal is to convert the database value to the right value to compare to the local value.
1 call to date_views_set_timezone()
- date_views_argument_handler::get_query_fields in date_views/
includes/ date_views_argument_handler.inc - Collect information about our fields we will need to create the right query.
File
- date_views/
includes/ date_views.views.inc, line 153 - Defines date-related Views data and plugins:
Code
function date_views_set_timezone(&$date_handler, &$view, $field) {
switch ($field['tz_handling']) {
case 'date':
$date_handler->db_timezone = 'UTC';
$date_handler->local_timezone_field = $field['timezone_field'];
$date_handler->offset_field = $field['offset_field'];
break;
case 'none':
$date_handler->db_timezone = drupal_get_user_timezone();
$date_handler->local_timezone = drupal_get_user_timezone();
break;
case 'utc':
$date_handler->db_timezone = 'UTC';
$date_handler->local_timezone = 'UTC';
break;
default:
$date_handler->db_timezone = 'UTC';
$date_handler->local_timezone = drupal_get_user_timezone();
break;
}
}