1

I am creating admin part for an app in which database is created on User's server at installation time of admin.I want to set the GMT for my mysql database according to timezone selected by the User.I am doing all this in Yii framework.How can i do this.

Happy
  • 792
  • 2
  • 10
  • 32

3 Answers3

1

You are required to use the date.timezone setting or the date_default_timezone_set() function.

To get around this, just open up index.php of your application and in the first line, add the following:

date_default_timezone_set('Timezone/String');

You should replace the ‘Timezone/String’ with your timezone information. Since my timezone is Asia/Kathmandu, I used:

date_default_timezone_set('Asia/Kathmandu');

Hope this helps.

Mohit Bhansali
  • 1,725
  • 4
  • 20
  • 43
0

Just add into your index.php in the root directory

date_default_timezone_set('_timezone_selected_by_user');
medina
  • 8,051
  • 4
  • 25
  • 24
0

You can do it by set timeZone property in your main config file. Check the code below and Yii Doc.

Check this: return array( 'timeZone' => 'Asia/Colombo', );

Shifrin
  • 154
  • 1
  • 11
  • He asked how to set the mysql time zone not the timezone that Yii/php is using. – Scott Jan 29 '14 at 20:01
  • Oh my bad, So check this out maybe it can help http://stackoverflow.com/questions/13916747/set-mysql-database-timezone-to-gmt – Shifrin Jan 30 '14 at 20:40