Set time zone in code
-
- date_default_timezone_set('Asia/Shanghai');//'Asia/Shanghai' Asia/Shanghai
- date_default_timezone_set('Asia/Chongqing');//where Asia/Chongqing' is "Asia/Chongqing"
- date_default_timezone_set ('PRC');//where PRC is "People's Republic of China"
- ini_set('date.timezone','Etc/GMT-8');
- ini_set('date.timezone','PRC');
- ini_set ('date.timezone','Asia/Shanghai');
- ini_set('date.timezone','Asia/Chongqing');
-
Copy code
Any of the above seven methods can satisfy us need.
During system initialization, add:
-
- ini_set('date.timezone','Asia/Shanghai'); or date_default_timezone_set("PRC");
-
Copy the code
to solve the problem of 8 hours difference in time zones.
|