PHP Time Zone issues

Source: Internet
Author: User
Tags echo date

Recently learning PHP encountered time zone problems, nonsense do not say on the code.

Phpdate_default_timezone_set (' PRC ');//Set the default time zone    /** * Print the necessary explanatory text*/    Print(<B> a few days from Monday?) </b>\n "); Print("<ol>\n");  for($currentDate= Time();//define $currentdate time format        Date("L",$currentDate)! = "Monday";//determine if the current system time is Monday        $currentDate+ = (60 * 60 * 24))//Current time plus 1 days    {        /** * Print time name*/        Print("<li>".Date("Y-m-d h:i:s",$currentDate). " ". " </li>\n "); }    Print("</ol>\n");?></body>

First, use Date_default_timezone_set () in the header to set my default time zone to GMT
Date_default_timezone_set (' PRC ');
echo Date (' y-m-d h:i:s ');
Time is the same as the current time of the server!!

Second, modify the php.ini.
Open Php5.ini Find Date.timezone Remove the preceding semicolon = Add xxx After, restart 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 PRC,PRC? PRC is the People's Republic of China Ah-_-above all from the official PHP documentation

Sort out the gmt+8 below the area, there may be omissions.

PHP Time Zone issues

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.