About PHP time Zone timing Error issuesDateCurrent time difference before local local date_default_timezone_set there is a legacy problem, that is, EchoDate("Y-m-d h:i:s", Time()) return time is always with the actual time is not on, today finally found in the online cause and solution, share the following: I add, I follow the instructions below to modify the PHP. INI can not find Date.timezone this line, is not there is no way, of course, no, haha no words on their own add, own hands and clothing. I added such a sentence Date.timezone = "PRC", the problem is done, happy.from PHP5.1.0 starts with the date added to the php.ini.timezone This option is turned off by default, that is, the displayed time (no matter what PHP command) is Greenwich Mean Time and our time (Beijing time) The difference is exactly 8 hours, there are the following 3 methods can restore normal time. 1, the simplest way is not to use PHP5.more than 1 of the version2, if you must use, and can not modify PHP.INI, you need to add Date_default_timezone_set (XXX) above the statement about the initialization of the time; CP does not have this problem3, once and for all, can only modify php.ini. Open php.ini Find date.timezone Remove the preceding semicolon=Add xxx to the back, restart the HTTP service (such as Apache2 or IIS, etc.) for XXX, the values available in mainland China are: Asia/chongqing, Asia/shanghai, asia/Urumqi (Chongqing, Shanghai, Urumqi, respectively) Taiwan available: Asia/macao, Asia/hong_kong, asia/Taipei (Macau, Hong Kong, Taipei) and Singapore: Asia/Singapore foreigners seem to have leaked Beijing. Other available values are: ETC/gmt-8, Singapore, Hongkong, what is PRCPRC? PRC is the People's Republic.-_------------------------------------------------------------------------------------------------------------- ---------How to solve:in the header, use Date_default_timezone_set () to set my default time zone to Beijing time Date_default_timezone_set (' PRC ');Echo Date(' y-m-d h:i:s '); The time is the same as the server's current time.!!congratulations on the attached Date_default_timezone_set usage as follows--------------------------------Date_default_timezone_set (PHP5 >= 5.1.0rc1) Date_default_timezone_set--Sets the default time zone description for all datetime functions in a script bool Date_default_timezone_set (stringtimezone_identifier) Date_default_timezone_set () sets the default time zone for all datetime functions. Note: Since PHP 5.1.0 (This version of the date time function is rewritten), if the time zone is not law, each call to a DateTime function will produce aE_noticelevel of error information. Parameter timezone_identifier time zone identifier, such as UTC or Europe/Lisbon return value This function always returnsTRUE(even if the timezone_identifier parameter is not valid). ------------------------------------------------------------------------------------------Append the time zone identifier:cetcst6cdtcubaeetegypteireestest5edtetc/gmtetc/gmt+0ETC/gmt+1ETC/gmt+10ETC/gmt+11ETC/gmt+12ETC/gmt+2ETC/gmt+3ETC/gmt+4ETC/gmt+5ETC/gmt+6ETC/gmt+7ETC/gmt+8ETC/gmt+9ETC/gmt-0ETC/gmt-1ETC/gmt-10ETC/gmt-11ETC/gmt-12ETC/gmt-13ETC/gmt-14ETC/gmt-2ETC/gmt-3ETC/gmt-4ETC/gmt-5ETC/gmt-6ETC/gmt-7ETC/gmt-8ETC/gmt-9ETC/gmt0etc/greenwichetc/uctetc/universaletc/utcetc/ZULUFACTORYGBGB-Eiregmtgmt+0GMT-0Gmt0greenwichhongkonghsticelandiranisraeljamaicajapankwajaleinlibyametmstmst7mdtnavajonznz-CHATPOLANDPORTUGALPRCPST8PDTROCROKSINGAPORETURKEYUCTUNIVERSALUTCW-Suwet
Go to: http://alanyr.blog.163.com/blog/static/181088453201142112630646/