Recently, I fixed a cross-Time Zone bug in the project. To fix this bug, it really takes a lot of effort. It seems that the main reason is that the development tasks do not involve this concept in normal times, and the test case for testing the
PHP cross-Time Zone (UTC time) application solution. 1. set the internal time zone of the program to UTC time. (UTC can also be called GMT) PHP settings: date_default_timezone_set (UTC); Yii settings: add timeZoneUTC to configmain. php.
1. set the
1. Set the program's internal time zone to UTC time. (UTC can also be called GMT)
PHP Settings:
Date_default_timezone_set ("UTC");
Yii settings:
Added in config/main.php: ' timeZone ' = ' UTC ',
When this is set, the time that PHP generates is
A project in Western Europe, before taking time simple with DateTime.UtcNow.AddHours (1); Western Europe is in the 1th time zone.It was correct until March, but both the EU countries and Switzerland implemented daylight saving time from the last
To solve the problem of PHP cross-time zone, you need to set the internal time zone of the program to UTC time. (UTC can also be called GMT) and store the UTC time in the database. if you are interested, you can understand
1. set the internal time
1. Set the internal time zone of the program to UTC time. (UTC can also be called GMT) PHP settings:Date_default_timezone_set ("UTC ");Yii settings:Add 'timezone '=> 'utc' to config/main. php ',After this setting, the time generated by PHP is
1. Set the internal time zone of the program to UTC time. (UTC can also be called GMT)
PHP settings:
Date_default_timezone_set ("UTC ");
Yii settings:
Add 'timezone '=> 'utc' to config/main. php ',
After this setting, the time generated by PHP is
This is a creation in
Article, where the information may have evolved or changed.
Fork Someone else a repository date resolution
The package is a simple function of converting an unknown date format into a standard date format, which can be used as
1. Set the internal time zone of the program to UTC time. (UTC can also be called GMT)
PHP Settings:
Date_default_timezone_set ("UTC");
Yii settings:
Added in config/main.php: ' TimeZone ' => ' UTC ',
After this setting, the PHP generation time is
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.