Page 1 of 1
can not set up my timezone
Posted: Sat Feb 20, 2016 12:55 am
by allgoo
hello,
i use a shared host on hostgator and i wasn't to change the local time zone so the products can be displayed in the local time and i can control the offers times correctly and the shipping dispatches.
i have been searching for 2 days for a solution but non solved my case
i have tried to do the following
* add SetEnv TZ Etc/GMT-3 in .htacceess
* change date_default_timezone_set('Etc/GMT-3'); in system/startup.php
* add <?php
putenv("TZ=Etc/GMT-3");
?>
<?php
date_default_timezone_set("Etc/GMT-3");
?> in /index.php and admin/index.php and
* add mysql_query("SET time_zone = 'Etc/GMT-3'"); in system/library/db/mysql.php
* add $this->link->query("SET time_zone = 'Etc/GMT-3'"); in system/library/db/mysqli.php
and nothing worked till now !
please help me find a solution for this
Re: can not set up my timezone
Posted: Sat Feb 20, 2016 2:06 am
by IP_CAM
Re: can not set up my timezone
Posted: Sat Feb 20, 2016 3:13 am
by allgoo
i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
Re: can not set up my timezone
Posted: Sat Feb 20, 2016 7:21 am
by EvolveWebHosting
allgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
The first 3 listed are free
Re: can not set up my timezone
Posted: Sat Feb 20, 2016 11:06 am
by allgoo
EvolveWebHosting wrote:allgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
The first 3 listed are free
not for oc 2.1.0.2
Re: can not set up my timezone
Posted: Sat Feb 20, 2016 11:43 am
by IP_CAM
that should not be so critical, some of them match OC 1.5 and OC 2.x
I would JUST try it out...
you got a 50/50 Chance, to get it for free! It should be worth that much...
Ernie
Re: can not set up my timezone
Posted: Sat Feb 20, 2016 3:43 pm
by artcore
http://php.net/manual/en/timezones.php
You're not supposed to add the offset in that function, just the zone.
Add
date_default_timezone_set(YOUR ZONE IN QUOTES);
like
date_default_timezone_set('America/Los_Angeles');
to both your index.php's right after <?php on a new line.
Re: can not set up my timezone
Posted: Mon Feb 22, 2016 10:22 am
by vincent_angbt
allgoo wrote:hello,
i use a shared host on hostgator and i wasn't to change the local time zone so the products can be displayed in the local time and i can control the offers times correctly and the shipping dispatches.
i have been searching for 2 days for a solution but non solved my case
i have tried to do the following
* add SetEnv TZ Etc/GMT-3 in .htacceess
* change date_default_timezone_set('Etc/GMT-3'); in system/startup.php
* add <?php
putenv("TZ=Etc/GMT-3");
?>
<?php
date_default_timezone_set("Etc/GMT-3");
?> in /index.php and admin/index.php and
* add mysql_query("SET time_zone = 'Etc/GMT-3'"); in system/library/db/mysql.php
* add $this->link->query("SET time_zone = 'Etc/GMT-3'"); in system/library/db/mysqli.php
and nothing worked till now !
please help me find a solution for this
Remove this on in system > startup.php:
if (!ini_get('date.timezone')) {
date_default_timezone_set('UTC');
and put this in:
date_default_timezone_set('America/Los_Angeles');
But you only will see report > customer activity is on the America/Los_Angeles, the rest remain unchange.
Re: can not set up my timezone
Posted: Mon Feb 22, 2016 10:38 am
by Burt65
allgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
I think you will find this extension will please you, as if fix all timezone problems and it comes with a beautiful UI
http://www.opencart.com/index.php?route ... n_id=25071
Re: can not set up my timezone
Posted: Mon Feb 22, 2016 1:33 pm
by allgoo
IP_CAM wrote:that should not be so critical, some of them match OC 1.5 and OC 2.x
I would JUST try it out...
you got a 50/50 Chance, to get it for free! It should be worth that much...
Ernie
will try those for 1.5, am not confident they will do but you have a point
artcore wrote:http://php.net/manual/en/timezones.php
You're not supposed to add the offset in that function, just the zone.
Add
date_default_timezone_set(YOUR ZONE IN QUOTES);
like
date_default_timezone_set('America/Los_Angeles');
to both your index.php's right after <?php on a new line.
vincent_angbt wrote:
Remove this on in system > startup.php:
if (!ini_get('date.timezone')) {
date_default_timezone_set('UTC');
and put this in:
date_default_timezone_set('America/Los_Angeles');
But you only will see report > customer activity is on the America/Los_Angeles, the rest remain unchange.
this gives me an error
Parse error: syntax error, unexpected '}' in /system/startup.php on line 29
Burt65 wrote:allgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
I think you will find this extension will please you, as if fix all timezone problems and it comes with a beautiful UI
http://www.opencart.com/index.php?route ... n_id=25071
tried it but it didn't even show where it should

Re: can not set up my timezone
Posted: Mon Feb 22, 2016 1:39 pm
by vincent_angbt
allgoo wrote:IP_CAM wrote:that should not be so critical, some of them match OC 1.5 and OC 2.x
I would JUST try it out...
you got a 50/50 Chance, to get it for free! It should be worth that much...
Ernie
will try those for 1.5, am not confident they will do but you have a point
artcore wrote:http://php.net/manual/en/timezones.php
You're not supposed to add the offset in that function, just the zone.
Add
date_default_timezone_set(YOUR ZONE IN QUOTES);
like
date_default_timezone_set('America/Los_Angeles');
to both your index.php's right after <?php on a new line.
vincent_angbt wrote:
Remove this on in system > startup.php:
if (!ini_get('date.timezone')) {
date_default_timezone_set('UTC');
and put this in:
date_default_timezone_set('America/Los_Angeles');
But you only will see report > customer activity is on the America/Los_Angeles, the rest remain unchange.
this gives me an error
Parse error: syntax error, unexpected '}' in /system/startup.php on line 29
Burt65 wrote:allgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
I think you will find this extension will please you, as if fix all timezone problems and it comes with a beautiful UI
http://www.opencart.com/index.php?route ... n_id=25071
tried it but it didn't even show where it should

i think you will give up this extension when you see this...
Re: can not set up my timezone
Posted: Mon Feb 22, 2016 2:18 pm
by allgoo
Burt65 wrote:allgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
I think you will find this extension will please you, as if fix all timezone problems and it comes with a beautiful UI
http://www.opencart.com/index.php?route ... n_id=25071
he changed it already :
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id><![CDATA[Set Timezone for php and database]]></id>
<version><![CDATA[1.0]]></version>
<vqmver required="true"><![CDATA[2.5.0]]></vqmver>
<author><![CDATA[Made Possible for Version 2.1.0.1 by Onnets - Original from Maulik Gandhi]]></author>
<file name="admin/view/template/setting/setting.tpl">
<operation error="log" info="">
<search position="before" offset="1"><![CDATA[<label class="col-sm-2 control-label"><span data-toggle="tooltip" title="<?php echo $help_maintenance; ?>"><?php echo $entry_maintenance; ?></span></label>]]></search>
<add><![CDATA[
<div class="form-group">
<label class="col-sm-2 control-label" for="input-timezone">Timezone</label>
<div class="col-sm-10">
<style type="text/css">
a.date{display:block;position:relative;width:80px;margin-bottom:18px;border:1px solid #888885;-moz-border-radius:5px;-webkit-border-radius:5px;font:24px/35px "Helvetica Neue",Arial,sans-serif;text-align:center;letter-spacing:2px;text-decoration:none;color:#666;background:#fcfcfc}
a.date sup{position:absolute;padding-top:25px;font-size:10px;line-height:10px;letter-spacing:normal}
a.date abbr{display:block;font:10px Verdana,sans-serif;letter-spacing:normal;color:#fff;-moz-border-radius-topright:5px;-webkit-border-top-right-radius:5px}
a.date>:first-child{margin:-1px 0 0 -1px;padding:0 5px;border:1px solid #832a28;line-height:16px;text-align:left;text-transform:uppercase;background:#a33537}
a.date sup+abbr{position:absolute;top:0;left:0;width:72px;padding:0 3px;border:1px solid #a33537;border-bottom:1px solid #832a28;line-height:14px;color:#eaa;text-align:right}
a.date sub{display:block;height:20px;border-top:1px solid #bbd;margin:0 3px;color:#000;font:11px/16px Verdana,sans-serif;letter-spacing:normal;text-align:center}
</style>
<?php
$timezones = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
$config_timezone = isset($this->request->post["config_timezone"]) ? $this->request->post["config_timezone"] : $this->config->get("config_timezone");
$timezone_options = "";
foreach ($timezones as $t) $timezone_options .= "<option value='$t' " . ($t == $config_timezone ? "selected" : "") . ">$t</option>";
$db_time = "Database time: " . $this->db->query("SELECT NOW() AS now")->row["now"];
$php_time = "PHP time: " . date("Y-m-d H:i:s");
?>
<select name="config_timezone" id="input-timezone" class="form-control">
<option value="">Select</option><?php echo $timezone_options; ?>
</select><br>
<div><a class='date'><abbr><?php echo date('M'); ?></abbr> <?php echo date('d'); ?><sup>th</sup> <abbr><?php echo date('Y'); ?></abbr>
<sub><?php echo date('h:i:s A'); ?></sub></a></div>
<div><?php echo $php_time; ?></div>
<div><?php echo $db_time; ?></div>
</div>
</div>
]]></add>
</operation>
</file>
<file name="system/startup.php">
<operation error="log" info="">
<search position="after"><![CDATA[require_once(DIR_SYSTEM . 'helper/utf8.php');]]></search>
<add><![CDATA[
$db = new mysqli(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$query = $db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE `key`='config_timezone'");
if ($query->num_rows) {
$timezone = $query->fetch_assoc();
if (!empty($timezone["value"])) date_default_timezone_set($timezone["value"]);
}
]]></add>
</operation>
</file>
<file name="system/library/db.php">
<operation error="log" info="">
<search position="after"><![CDATA[public function query($sql) {]]></search>
<add><![CDATA[
$now = new DateTime();
$mins = $now->getOffset() / 60;
$sgn = ($mins < 0 ? -1 : 1);
$mins = abs($mins);
$hrs = floor($mins / 60);
$mins -= $hrs * 60;
$offset = sprintf('%+d:%02d', $hrs*$sgn, $mins);
$this->db->query("SET time_zone='$offset'");
]]></add>
</operation>
</file>
</modification>
Re: can not set up my timezone
Posted: Mon Feb 22, 2016 2:28 pm
by vincent_angbt
allgoo wrote:Burt65 wrote:allgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
I think you will find this extension will please you, as if fix all timezone problems and it comes with a beautiful UI
http://www.opencart.com/index.php?route ... n_id=25071
he changed it already :
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id><![CDATA[Set Timezone for php and database]]></id>
<version><![CDATA[1.0]]></version>
<vqmver required="true"><![CDATA[2.5.0]]></vqmver>
<author><![CDATA[Made Possible for Version 2.1.0.1 by Onnets - Original from Maulik Gandhi]]></author>
<file name="admin/view/template/setting/setting.tpl">
<operation error="log" info="">
<search position="before" offset="1"><![CDATA[<label class="col-sm-2 control-label"><span data-toggle="tooltip" title="<?php echo $help_maintenance; ?>"><?php echo $entry_maintenance; ?></span></label>]]></search>
<add><![CDATA[
<div class="form-group">
<label class="col-sm-2 control-label" for="input-timezone">Timezone</label>
<div class="col-sm-10">
<style type="text/css">
a.date{display:block;position:relative;width:80px;margin-bottom:18px;border:1px solid #888885;-moz-border-radius:5px;-webkit-border-radius:5px;font:24px/35px "Helvetica Neue",Arial,sans-serif;text-align:center;letter-spacing:2px;text-decoration:none;color:#666;background:#fcfcfc}
a.date sup{position:absolute;padding-top:25px;font-size:10px;line-height:10px;letter-spacing:normal}
a.date abbr{display:block;font:10px Verdana,sans-serif;letter-spacing:normal;color:#fff;-moz-border-radius-topright:5px;-webkit-border-top-right-radius:5px}
a.date>:first-child{margin:-1px 0 0 -1px;padding:0 5px;border:1px solid #832a28;line-height:16px;text-align:left;text-transform:uppercase;background:#a33537}
a.date sup+abbr{position:absolute;top:0;left:0;width:72px;padding:0 3px;border:1px solid #a33537;border-bottom:1px solid #832a28;line-height:14px;color:#eaa;text-align:right}
a.date sub{display:block;height:20px;border-top:1px solid #bbd;margin:0 3px;color:#000;font:11px/16px Verdana,sans-serif;letter-spacing:normal;text-align:center}
</style>
<?php
$timezones = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
$config_timezone = isset($this->request->post["config_timezone"]) ? $this->request->post["config_timezone"] : $this->config->get("config_timezone");
$timezone_options = "";
foreach ($timezones as $t) $timezone_options .= "<option value='$t' " . ($t == $config_timezone ? "selected" : "") . ">$t</option>";
$db_time = "Database time: " . $this->db->query("SELECT NOW() AS now")->row["now"];
$php_time = "PHP time: " . date("Y-m-d H:i:s");
?>
<select name="config_timezone" id="input-timezone" class="form-control">
<option value="">Select</option><?php echo $timezone_options; ?>
</select><br>
<div><a class='date'><abbr><?php echo date('M'); ?></abbr> <?php echo date('d'); ?><sup>th</sup> <abbr><?php echo date('Y'); ?></abbr>
<sub><?php echo date('h:i:s A'); ?></sub></a></div>
<div><?php echo $php_time; ?></div>
<div><?php echo $db_time; ?></div>
</div>
</div>
]]></add>
</operation>
</file>
<file name="system/startup.php">
<operation error="log" info="">
<search position="after"><![CDATA[require_once(DIR_SYSTEM . 'helper/utf8.php');]]></search>
<add><![CDATA[
$db = new mysqli(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$query = $db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE `key`='config_timezone'");
if ($query->num_rows) {
$timezone = $query->fetch_assoc();
if (!empty($timezone["value"])) date_default_timezone_set($timezone["value"]);
}
]]></add>
</operation>
</file>
<file name="system/library/db.php">
<operation error="log" info="">
<search position="after"><![CDATA[public function query($sql) {]]></search>
<add><![CDATA[
$now = new DateTime();
$mins = $now->getOffset() / 60;
$sgn = ($mins < 0 ? -1 : 1);
$mins = abs($mins);
$hrs = floor($mins / 60);
$mins -= $hrs * 60;
$offset = sprintf('%+d:%02d', $hrs*$sgn, $mins);
$this->db->query("SET time_zone='$offset'");
]]></add>
</operation>
</file>
</modification>
Re: can not set up my timezone
Posted: Mon Feb 22, 2016 2:53 pm
by Burt65
Yes I notice that... That's why I didn't bother to reply to him. But I'm using this extension in OC 2.1.0.2 and it works beautifully. And because it works on both DB and front end it also did fix my problem with countdown timer that use to go by the server time instead of my location time. That's why I suggested to you...
Re: can not set up my timezone
Posted: Mon Feb 22, 2016 6:43 pm
by allgoo
Burt65 wrote:Yes I notice that... That's why I didn't bother to reply to him. But I'm using this extension in OC 2.1.0.2 and it works beautifully. And because it works on both DB and front end it also did fix my problem with countdown timer that use to go by the server time instead of my location time. That's why I suggested to you...
if it works fine with you then the problem has to be from my side , i changed the admin path and changed it in the code as well but it didn't work , can you share the file you have with me please
Re: can not set up my timezone
Posted: Mon Feb 22, 2016 7:17 pm
by Burt65
allgoo wrote:Burt65 wrote:Yes I notice that... That's why I didn't bother to reply to him. But I'm using this extension in OC 2.1.0.2 and it works beautifully. And because it works on both DB and front end it also did fix my problem with countdown timer that use to go by the server time instead of my location time. That's why I suggested to you...
if it works fine with you then the problem has to be from my side , i changed the admin path and changed it in the code as well but it didn't work , can you share the file you have with me please
This thread is getting really confusing...
From the beginning...
OC 2.1.x.x
everything original in startup.php, mysql.php mysqli.php and what ever other file you have modify.
Then use the extension mentioned above (the one for 2.1.x.x, that now is good) and set your timezone in Admin/setting/server/timezone.
That's it. That's all I did. That's all I know...
Re: can not set up my timezone
Posted: Mon Feb 22, 2016 9:34 pm
by IP_CAM
AND MAKE SURE, to change in your config.php files from mysql to mysqli, because mysql won't work any longer with new Server PHP Versions !
define('DB_DRIVER', 'mysqli');
Ernie
openshop.li
Re: can not set up my timezone
Posted: Tue Feb 23, 2016 1:17 am
by allgoo
i did all what you guys mentioned but still it doesn't show where it should be ,, this is becoming so annoying

Re: can not set up my timezone
Posted: Tue Feb 23, 2016 12:44 pm
by allgoo
after reinstalling my vqmod i got this error in the server tab admin panel
HP Notice: Undefined property: Loader::$config in /vqmod/vqcache/vq2-system_storage_modification_admin_view_template_setting_setting.tpl on line 1397
Code: Select all
1396: $timezones = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
1397: $config_timezone = isset($this->request->post["config_timezone"]) ? $this->request->post["config_timezone"] : $this->config->get("config_timezone");
1398: $timezone_options = "";
any idea ?
Re: can not set up my timezone
Posted: Fri Apr 08, 2016 11:26 am
by thbr02
My host was updated to PHP 7 when the error appeared. When changing back to PHP 5.5 the time error disappeared.
When using burt65's extension I get this error:
Code: Select all
Undefined property: Loader::$config in /home/torshammar/domains/torshammarens.se/public_html/vqmod/vqcache/vq2-system_storage_modification_admin_view_template_setting_setting.tpl on line 1504