I tried to put up a patch for this, but my brain is hurting form all the date/time formatting issues, here's to hoping some else will know how to do this. Though I think this feature in jira will goa long way towards fixing this?
http://issues.civicrm.org/jira/browse/CRM-2709When the datetime handler for views submits a date to the views date handler (views_handler_field_date) views is expecting it to be the timestamp for the server's time zone. If the the date is entered for a different time zone than that of the server then views presents the date according to the users time zone but assuming the events takes place in the server timezone, which isn't always true.
i.e. An event is entered in as 10 am EST for a site sitting on a server in PST. Views, strtotime(), converts that time to 10am PST and then returns it to an EST user as 1pm because it thinks the time is 10am PST. The issue is strtotime() function calculates the timestamp based on the server's time zone. Drupal saves the user's, and a default, timezone. The only thing I couldn't pull off what figuring out it the users timezone was affected by Day Light Savings.
adding the $timezone variable in the following code hacked copy of handler, using code from Drupal's format_date, to the $value get about 90% of the way there.
you can get around this by setting the default time zone to that of the server & disabling the user defined time zones, which of course sucks for the users but eliminates confusion.
class civicrm_handler_field_datetime extends views_handler_field_date {
/*
* Convert the DATETIME from the database into unixtime then allow
* views_handler_field_date to render as usual.
*/
function render($values) {
$value = $values->{$this->field_alias};
if($value) {
global $user;
if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) {
$timezone = $user->timezone;
}
else {
$timezone = variable_get('date_default_timezone', 0);
}
$value = strtotime($value);
$value += $timezone;
if($value) {
$values->{$this->field_alias} = $value;
}
}
return parent::render($values);
}
}
Jim