Topic: Time Zone error

The default time_zone is defined in the sys_prefs table.
It is also conditionally set as a php.ini variable in the config.php file.

The order of Timezone precedence in the includes/prefs/sysprefs.inc is in lines 33 to 45:

        foreach(get_defined_vars() as $name => $value)
            $this->$name = $value;

        if (!@$this->time_zone)
            $this->time_zone = ini_get('date.timezone');

        if (!$this->time_zone)
            $this->time_zone = 'Europe/Berlin';
            
        if (!isset($this->use_popup_search))
            $this->use_popup_search = false;

           ini_set('date.timezone', $this->time_zone);

This does not respect the php.ini's value (or its' scripted set value from the config.php) and in actuality gets overwritten by the 'Europe/Berlin' fallback value and reflects in the footer timestamp displayed in the FA pages even after login whence a current_user is available in the session variable.

The solution is to make an unconditional setting in the config.(config.default.php) file by replacing lines 25-26:

    if (!ini_get('date.timezone'))
        ini_set('date.timezone', 'Europe/Berlin');

with

    ini_set('date.timezone', 'Europe/Berlin');

2 (edited by Caribe95 01/10/2021 08:54:58 am)

Re: Time Zone error

Hello:
For me, in ubuntu worked editing  php.ini in /etc/php/7.4/apache2/ with nano or gedit (I'm on php 7.4)
First make a copy of your php.ini, then:

sudo gedit /etc/php/7.4/apache2/php.ini

find:
;date.timezone =

replace it with:
date.timezone = 'YourContinent/YourCity' (and no ";" at start  wink )

Example:
date.timezone = 'America/Santiago'

Save, exit.


restart apache2:
sudo systemctl restart apache2

Saludos
Victor R.