function date_views_set_timezone in Date 6.2
Same name and namespace in other branches
- 8 date_views/includes/date_views.views.inc \date_views_set_timezone()
- 5.2 date/date_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.
2 calls to date_views_set_timezone()
File
- includes/
date_api.views.inc, line 184 - Defines date-related Views data and plugins:
Code
function date_views_set_timezone(&$date_handler, &$view, $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;
}
}