Yii2 Date formatting

Source: Internet
Author: User
TimeZone has been set, but Formatter formatting does not work. it is still in English format. {code ...} server Output: {code ...} good local: {code ...} why ~ The server php5.5.9 local php5.6.11 has been set timeZone, But use FormatterFormatting does not work. it is still in English format.

'timeZone' => 'Asia/Shanghai'dd(    date_default_timezone_get(),    Yii::$app->getTimeZone(),    Yii::$app->formatter->timeZone,    Yii::$app->formatter->asDate('2016-05-15'),    date('Y-m-d H:i:s'));

Server Output:

"Asia/Shanghai""Asia/Shanghai""Asia/Shanghai""May 15, 2016""2016-06-16 15:54:53"

Local is good:

"Asia/Shanghai" "May 15, 2016" 15:54:45"

Why ~
Serverphp 5.5.9
Localphp 5.6.11

Reply content:

SettimeZone, But useFormatterFormatting does not work. it is still in English format.

'timeZone' => 'Asia/Shanghai'dd(    date_default_timezone_get(),    Yii::$app->getTimeZone(),    Yii::$app->formatter->timeZone,    Yii::$app->formatter->asDate('2016-05-15'),    date('Y-m-d H:i:s'));

Server Output:

"Asia/Shanghai""Asia/Shanghai""Asia/Shanghai""May 15, 2016""2016-06-16 15:54:53"

Local is good:

"Asia/Shanghai" "May 15, 2016" 15:54:45"

Why ~
Serverphp 5.5.9
Localphp 5.6.11

AndphpThe version should be okay. check whether the time parameter format in your configuration file is different.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.