Home > Article > PHP Framework > Where to set the time zone in yii2
In the yii framework, you can set the time zone directly in /protected/config/main.php (Additional: The same is true for Yii2 method, in common/config/main .php). (Recommended learning: yii tutorial )
In the config folder, 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' ] ] ];
The above is the detailed content of Where to set the time zone in yii2. For more information, please follow other related articles on the PHP Chinese website!