Post by jasonc310771 » Tue Nov 10, 2015 8:23 pm

I can not change the timezone of the database, as many other can not) and think that a sitewide timezone is needed.

Most of the php files use the reference NOW() for database queries, and the date/time of this can be different to the web server holding the site files. Most of us can use PHP's date_default_timezone_set to set the default timezone, but there is not one for the database server which is global for all accounts.

My suggestion is to have a 'custom_date_time' define in both of the config.php (catalog and admin) to globally set a date and time to use. Then have the NOW() in all files changed to custom_date_time so it uses this date/time and not that which is set by the database servers system date/time.

This will allow us to have a local date/time entered in the databases for our own timezone.

Active Member

Posts

Joined
Fri Mar 01, 2013 6:46 pm

Post by yodapt » Tue Nov 10, 2015 10:06 pm

You can set the timezone when connecting to the database, or convert it while inserting / updating, but it would assume the timezone exists in mysql which is not always the case. I'll work on a solution later today.

Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com


User avatar
Active Member

Posts

Joined
Fri Jun 17, 2011 6:39 pm


Post by labeshops » Wed Nov 11, 2015 12:08 am

There are extensions to do this in the extension store. I use a free one for v1.5, but do a search and you will find them.

Running Opencart v3.0.3.9 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA
Who is online

Users browsing this forum: No registered users and 7 guests