TimeZone Problem
Posted:
13 Sep 2018, 12:55
by luckyphan
Hello,
We have changed the php.ini & user.ini timezone from the webserver & now the webserver has shown the correct timezone, but only from openrealestate, the timezone is still wrong. So any news posted & new listings posted are still showing wrong timezone - the server php.ini & user.ini timezone is already correct & updated.
How to adjust/change the timezone on the openrealestate ?
Thanks,
Re: TimeZone Problem
Posted:
13 Sep 2018, 13:48
by Xpycm
Hello.
In what incorrectness of a time zone is expressed? Please, provide screenshots and examples.
Look at the creation time (field `date_created`) of the news or articles in the database table. table {prefix}entries. Listings: table {prefix}apartments (field `date_created`) .
Mysql can have its own time zone:
https://www.google.com/search?q=mysql+t ... 8&oe=utf-8Try to set the same time zone for mysql as in php.ini
Re: TimeZone Problem
Posted:
14 Sep 2018, 06:24
by luckyphan
Hi,
I was told by my hosting that they're not able to change the default SQL timezone, but there is a workaround :
*****************************************
So, in summary… once you’ve opened the mysql connection in your PHP script, just add these two lines:
date_default_timezone_set(‘Asia/Jakarta’);
mysql_query(“SET `time_zone` = ‘”.date(‘P’).”‘”);
And that’s about it.
****************************************
Now my question is : where should I paste this command on your OpenRealEstate ?
Thanks
Re: TimeZone Problem
Posted:
14 Sep 2018, 08:23
by Xpycm
mmm ... hosting provider can't change the time zone in its own server ... okaaaaay.
in index.php (in root directory)
before:
- Code: Select all
$yii=dirname(__FILE__).'/framework/yii.php'
insert:
- Code: Select all
date_default_timezone_set('Etc/GMT+7');;
and in protected/config/db.php
after:
- Code: Select all
'tablePrefix' => 'YOUR_TABLES_PREFIX',
insert:
- Code: Select all
'initSQLs' => array('SET time_zone = "+07:00";', 'SET @@session.time_zone = "+07:00";'),
Re: TimeZone Problem
Posted:
17 Sep 2018, 05:57
by luckyphan
Thanks - shall try & test later.