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

How to set the time zone in yii2.0

王林
Release: 2020-02-25 17:34:10
Original
2457 people have browsed it

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'
        ]
    ]
];
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template