function date_views_set_timezone in Date 5.2
Same name and namespace in other branches
- 8 date_views/includes/date_views.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.
4 calls to date_views_set_timezone()
- _date_views_argument_filter in date/
date_views.inc - Views values vary depending on the op: $op = 'filter' $argtype = array of arg settings $query = views object $arg = argument value
- _date_views_argument_summary in date/
date_views.inc - Views values vary depending on the op: $op = 'summary' $argtype = name of the argument $query = views object $arg = argument type
- _date_views_filter_handler in date/
date_views.inc - _date_views_query_alter in date/
date_views.inc - Implementation of hook_views_query().
File
- date/
date_views.inc, line 757
Code
function date_views_set_timezone(&$date_handler, $field) {
$tz_handling = $field['tz_handling'];
switch ($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 = date_default_timezone_name();
$date_handler->local_timezone = date_default_timezone_name();
break;
case 'utc':
$date_handler->db_timezone = 'UTC';
$date_handler->local_timezone = 'UTC';
break;
default:
$date_handler->db_timezone = 'UTC';
$date_handler->local_timezone = date_default_timezone_name();
break;
}
}