[Vtigercrm-developers] $default_timezone and a world of pain
Alan Bell
alan.bell at libertus.co.uk
Thu May 7 13:17:23 GMT 2015
In short, always set $default_timezone in config.inc.php to UTC and all
will be well.
in this file:
include/fields/DateTimeField.php
there is a function:
static function getDBTimeZone() {
if(empty(self::$databaseTimeZone)) {
$defaultTimeZone = date_default_timezone_get();
if(empty($defaultTimeZone)) {
$defaultTimeZone = 'UTC';
}
self::$databaseTimeZone = $defaultTimeZone;
}
return self::$databaseTimeZone;
}
the effect of this is that if you have specified something like
'Europe/London' in your config.inc.php then vtiger 6.2 will store all
datetime fields in your system's default time zone rather than UTC. This
looks like it is working OK for a while in the vtiger user interface.
After daylight savings or British summer time happens then the system
will mess up times that were saved with the other offset. It also
completely messes up synchronisation with exchange/android/ipad/anything
else because those all expect the system to store UTC internally.
$default_timezone basically performs two functions now, it is the
default timezone for new users (or users who have no timezone specified,
but I don't know how to do that) and it is also the database timezone,
which is a bit scary. I can't see any reason why anyone would ever want
the database to be storing times in anything but UTC, and especially not
in a zone with daylight savings.
Alan.
More information about the vtigercrm-developers
mailing list