Home >PHP Framework >YII >How to set the time zone in yii2.0

How to set the time zone in yii2.0

王林
王林Original
2020-02-25 17:34:102478browse

How to set the time zone in yii2.0

Open the main.php file and configure it as follows:

(Recommended tutorial: yii framework)

return [
    'charset' => 'utf-8',
    'language' => 'zh-CN',
    'timeZone' => 'Asia/Shanghai',
    'components' => ['formatter' => [
            'dateFormat' => 'yyyy-MM-dd',
            'timeFormat' => 'HH:mm:ss',
            'datetimeFormat' => 'yyyy-MM-dd HH:mm:ss'
        ]
    ]
];

More For programming-related content, please pay attention to the Introduction to Programming column on the php Chinese website!

The above is the detailed content of How to set the time zone in yii2.0. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn