Skip to content
-
Subscribe to our newsletter & never miss our best posts. Subscribe Now!
Technical Personnal Blog

Technical Personnal Blog

Technical Personnal Blog

Technical Personnal Blog

  • Tech
  • Blog
  • Open Source
  • VEGAS
  • CARD
  • Favorite Link
  • Shop
  • Cart
  • Checkout
  • My account
  • Tech
  • Blog
  • Open Source
  • VEGAS
  • CARD
  • Favorite Link
  • Shop
  • Cart
  • Checkout
  • My account
Close

Search

  • https://www.facebook.com/
  • https://twitter.com/
  • https://t.me/
  • https://www.instagram.com/
  • https://youtube.com/
Subscribe
opencart

How to change OpenCart Timezone?

By techsupport
April 25, 2018 2 Min Read
Comments Off on How to change OpenCart Timezone?

OpenCart is an online store management system which is freely available under the GNU General Public License. It is PHP-based using MySQL database and HTML components. It is a well known simple and light weight eCommerce platform used to make small to medium size eCommerce website. It is a well-designed user interface with a higher selection of extensions.

OpenCart is used globally and operated from different timezone based on the site owner’s place. In most of the cases, OpenCart site run in UTC timezone. This can affect all the aspects that depend on the time zone such as product comment, special price to order history.

To Change the PHP Timezone:

The PHP time zone can be changed in two methods through php.ini or set them directly at PHP file.

1) To change the timezone in php.ini, seek the help from the hosting provider as one host to another have a different approach.

2) Use the following code and change the system/startup.php with PHP supported timezone.

if (!ini_get('date.timezone')) {

date_default_timezone_set('UTC');

}

date_default_timezone_set('Australia/Sydney');

In the above code, ‘date.timezone’ was configured in php.ini and the time zone will be changed. Make sure that after changing the PHP timezone, synchronize it with the database.

To Synchronize PHP and Database Timezone:

To synchronize the PHP and database timezone, set the database connection timezone. The global database timezone can be set but that needs super-privileged user which will not be available on shared hosting. The following query is used to set the database timezone

SET time_zone='offset';

Here offset and not named timezone is used because the named time zones can be used only if the time zone information tables in the MySQL database are created and populated.

To change the OpenCart database connection time zone, change the system/library/db/mysqli.php and add the following code after $this -> connection -> query(“SET SQL_MODE=””);

$dt = new \DateTime();

$this -> connection -> query("SET time_zone = ' ".$dt->format('p')." ' ; ");

In the OpenCart version 2.0x and 2.1x, change $this -> connection to $this -> link.

Before checking the result, refresh the modification at Extensions > Modification as the system information use OcMod to get the database information.

Author

techsupport

Follow Me
Other Articles
Previous

PHP 제거하는 공식

Next

메이븐 (maven) 설치 및 이클립스 연동하기

Categories

  • Android
  • Blog
  • Favorite Link
  • linux
  • Open Source
  • opencart
  • social
  • Tech
  • Uncategorized

Archives

  • January 2025
  • March 2024
  • August 2023
  • March 2023
  • February 2023
  • November 2021
  • August 2021
  • April 2021
  • March 2021
  • December 2020
  • October 2020
  • September 2020
  • July 2020
  • June 2020
  • May 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • September 2019
  • August 2019
  • June 2019
  • October 2018
  • August 2018
  • May 2018
  • April 2018
  • March 2018
  • January 2018
  • December 2017
  • November 2017
  • October 2017
  • September 2017
  • August 2017
  • June 2017
  • March 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • September 2016
  • August 2016
  • July 2016
  • June 2016
  • May 2016
  • April 2016
  • January 2016
  • December 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
Copyright 2026 — Technical Personnal Blog. All rights reserved. Blogsy WordPress Theme