Код: Выделить всё
// Globally define the Timezone
define('TIMEZONE', 'EST');
// Set Timezone
date_default_timezone_set(TIMEZONE);
Код: Выделить всё
[
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=dbname',
'username' => 'root',
'password' => 'pass',
'charset' => 'utf8',
'on afterOpen' => function ($event) {
// $event->sender refers to the DB connection
$event->sender->createCommand("SET time_zone = '" . TIMEZONE . "'")->execute();
}
];
Может есть другой способ?