zone problem in date function
Date ("y-m-d h:i:s") Totals server time by a few hours
The workaround is as follows:
First, use Date_default_timezone_set () in the header to set my default time zone for the year
The code is as follows
Copy Code
Date_default_timezone_set (' PRC ');echo Date (' y-m-d h:i:s ');
Time is the same as the server current time!!
Second, modify the php.ini.
Open Php5.ini Find Date.timezone Remove the preceding semicolon = Add xxx
At present, Aliyun has provided Qingdao, Beijing, Shenzhen, Shanghai, the United States, Singapore, Hong Kong and many other room, the first article to record how we purchase Aliyun ECS server.
First, Aliyun official website
The code is as follows
Copy Code
Website address: www.aliyun.com
We need to prepare a Aliyun account, here is very simple, generally we have Taobao account
Reason: network resource collationFrom php5.1.0 onwards, php.ini riga date.timezone This option, and by default it is the time to display (no matter what PHP command) is Greenwich Mean Time and our time (Beijing time) The difference is exactly 8 hours.About timezone Mainland China available values are: asia/chongqing, Asia/shanghai, Asia/urumqi, PRC (Chongqing, Shanghai, Urumqi, PRC) Taiwan available: Asia/macao, asia/ Hong_Kong, Asia/taipei (Macau, Hong Kong, Taipei) and
service, with tens of thousands of customers at home and abroad to establish a loyal cooperative relationship, the developer appreciated and recognized, and in 1994, the largest development in New Zealand, Fletcherchallenge awarded the Outstanding Sales Award, And 1999 France's largest real estate developer appointed the company for the Southeast Asian property General agent. We have successfully planned and sold hundreds of large-scale projects in China, France,
Originally from php5.1.0 start, php.ini added date.timezone this option, by default is closed
That is, the time that is displayed (no matter what PHP command is used) is Greenwich Standard Time
And our Time (Beijing time) is bad for just 8 hours, there are the following 3 methods can restore normal time.
1, the easiest way is not to use the php5.1 version
2, if you must use, and can not modify the php.ini, you need in the initialization of the statement of the time
Add Date_default_timez
~202.177.031.255 Hong Kong
202.176.002.000~202.176.003.255 Japan
202.176.001.000~202.176.001.255 Japan
202.176.000.128~202.176.000.255 Japan
202.176.000.064~202.176.000.127 Japan
202.176.000.032~202.176.000.063 Japan
202.176.000.000~202.176.000.031 Singapore
202.172.000.000~202.175.255.255 Macau
202.171.000.000~202.171.255.255 Macau
202.170.224.000~202.170.255.255 Indonesia
202.170.128.000~202.170.159.255 India
202.170.064.000~202.170.095.255 Mongolia
) Taiwan available: Asia/macao, Asia/hong_kong, Asia/taipei (Macao, Hong Kong, Taipei) Singapore: Asia/singapore Foreigners seem to have leaked Beijing. Other available values are: etc/gmt-8, Singapore, Hongkong, PRC PRC? PRC is the People's Republic of China 3, if you must use more than php5.1 version, and can not modify the php.ini configuration file. (1
price of $6.00.
3. Practical Cases
Recognizing the value and potential of vertical agriculture, some international giants have begun to enter the market, even if they have never been involved in agriculture. Japan's Panasonic electronics has the largest indoor farm in Singapore. Since 2014, Panasonic has been planting vegetables in a warehouse in Singapore and selling it to local retailers and restauran
, easy to use.
Jsqmessagesviewcontroller
A common Chat interface framework, good results, thanks to the author of Open source. The framework was later modified into a messagedisplaykit by a shameless domestic programmer, with a great potential for appropriation.
Vteam
A developer's development framework built up over the years is worth seeing.
Aggeometrykit
The geometry framework, which combines aggeometrykit and POPs, enables
You can set the value of the date. timezone key to 'Asia/Shanghai' in the urban configuration of the PHP script in php. ini. However, the shared VM itself does not have the permission to modify php. ini. This should be added to the public part of the program.Ini_set ('date. timezone ', 'Asia/Shanghai'); Modify the settings of php. ini dynamically. Then you can test whether the time is correct:Var_dump (date (); If the local time of the server is correct, the problem is generally solved. Appendix
Comments: Dear Friends, please hurry up and get the MCSD certificate (worth more than one thousand oceans) from Microsoft HTML5, JavaScript and CSS3 for free.
Dear friends, hurry up and get the MCSD Certificate of Microsoft HTML5, JavaScript and CSS3 for free (worth more than one thousand oceans ). If you are interested in this, we will complete the registration and exam booking with the Paladin (PS. If you do not go to work today in Singapore, I will
leased line.Air Mail)
The parcel belongs to the postal system. Because of the protocol of Wanguo post, it has the widest coverage and can be used there. The disadvantage is that it has a poor timeliness, sometimes fast and sometimes slow, and may cause packet loss.
Here, I will explain what a small package is. The small package can be known as a small package. In principle, it is a package smaller than 2kg, because of its different regions, it is divided into small packets from different countr
) 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 PRC PRC? PRC is the People's Republic of China Ah 3, if you must use more than php5.1 version, and can not modify the php.ini configuration
) difference is exactly 8 hours, there are the following 2 ways to restore normal time.1, if you want to use more than 5.1 version, and do not modify php.ini, you need to be on the initialization of the time of the statement with Date_default_timezone_set (XXX), or use the date (' y-m-d g:i:t ', Strtotime ( ' +8hour ')) to obtain the date and time;2, once and for all, only can modify php.ini. Open the php.ini to remove the semicolon in front of the date.timezone, add xxx after =, restart the HTT
functions to modify the corresponding time zone:
Date_default_timezone_set ('Asia/Shanghai ');
We recommend that you use this function because it is more common. Corresponding to 'Asia/Shanghai', other available mainland time zones include Asia/Chongqing, Asia/Shanghai, and Asia/Urumqi (Chongqing, Shanghai, and Urumqi in sequence). Hong Kong and Taiwan regions are available: asia/Macao, Asia/Hong_Kong, Asia/Taipei (Macau, Hong Kong, and Taipei in sequence),
."
. Net competitors
In recent years, a group of software companies in China have developed a group of software platforms and products using Java technology. Java has developed rapidly in China over the past two years. However, although it seems that the Java team is very powerful, there are still few domestic Java talents."Sun has set up a Java advanced training center in Singapore. Currently, there are 50 thousand Java talents in
corresponding time zone:
Date_default_timezone_set ('Asia/Shanghai ');
We recommend that you use this function because it is more common. Corresponding to 'Asia/Shanghai', other available mainland time zones include Asia/Chongqing, Asia/Shanghai, and Asia/Urumqi (Chongqing, Shanghai, and Urumqi in sequence). Hong Kong and Taiwan regions are available: asia/Macao, Asia/Hong_Kong, Asia/Taipei (Macau, Hong Kong, and Taipei in sequence), Singapore: Asia/
should be added to the public part of the program.
Ini_set ('date. timezone ', 'Asia/Shanghai ');
Modify php. ini settings dynamically. Then you can test whether the time is correct:Var_dump (date ());
If the local time of the server is correct, the problem can be solved. Appendix: PHP 5.1 and above provide special functions to modify the corresponding time zone:
Date_default_timezone_set ('Asia/Shanghai ');
We recommend that you use this function because it is more common. Corresponding to 'As
Report decision platform Implementation Enterprise introductionTianjin Le Bin department store is located in the heart of Tianjin, is the world's top 500 enterprises, Lippo Group in China's main department store brand, with the same Lippo group of Singapore Robinson department store, Singapore Little John Department Stores, Singapore and Malaysia's Martha departm
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.