OpenCart 3: store time_zone

To Whom … is West of UTC (UTC-XX)

  • Unable to log-in as the admin
  • API (for ex: update order status) calls are not working

All of the above, it will call framework.php

date_default_timezone_set($config->get('date_timezone'));
... 
// Database 
if ($config->get('db_autostart')) { 
// Sync PHP and DB time zones 
  $db->query("SET time_zone = '" . $db->escape(date('P')) . "'"); 
}

with time_zone from /system/config/default.php

// Date
$_['date_timezone'        = 'UTC'

Solution 1

Change the default time_zone in /system/config/default.php with yours, for example in my case:

// Date
$_['date_timezone']        = 'America/New_York';

Solution 2

Add to the /system/framework.php (above line 83) the following code:

// timezone	
$query = $db->query("SELECT value FROM " . DB_PREFIX . "setting WHERE key = 'config_timezone'");
if ($query->num_rows) {
  date_default_timezone_set($query->row['value']);
}

3 thoughts on “OpenCart 3: store time_zone

Leave a Reply

Your email address will not be published. Required fields are marked *

Yandex.Metrica