Created
October 24, 2015 09:16
-
-
Save SilverFire/6f98d2605a6574bd02f7 to your computer and use it in GitHub Desktop.
Yii2 set timezone for DB connection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return [ | |
'components' => [ | |
'db' => [ | |
'class' => '\yii\db\Connection', | |
'dsn' => 'mysql:host=127.0.0.1;dbname=demo', | |
'username' => 'root', | |
'password' => '', | |
'charset' => 'utf8', | |
'on afterOpen' => function($event) { | |
$event->sender->createCommand("SET time_zone='+00:00';")->execute(); | |
}, | |
], | |
] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice, and also we can use the UTC like this:
America/Manaus is similar to -04:00