在config文件夹下,main.php 中,
return [ 'charset' => 'utf-8', 'language' => 'zh-cn', 'timezone' => 'asia/shanghai', 'components' => [ 'cache' => [ 'class' => 'yii\caching\filecache' ], 'formatter' => [ 'dateformat' => 'yyyy-mm-dd', 'timeformat' => 'hh:mm:ss', 'datetimeformat' => 'yyyy-mm-dd hh:mm:ss' ] ]];
以上就是yii2哪里设置时区的详细内容。
