Dingxianghuachengrenshequ the date in PHP5 is not a workaround for the current time

Source: Internet
Author: User
Tags echo date
The related setting is to modify the Date.timezone parameter in php.ini:
[Date]
; Defines the default timezone used by the date functions
;d Ate.timezone =
The default is off, just remove the comment, you can
[Date]
; Defines the default timezone used by the date functions
Date.timezone = PRC
Where PRC is the "People's Republic"!
Other options refer to the PHP manual.
However, the above-mentioned Asian region has missed our capital Beijing, do not know that foreigners are not intentional!
If you do not have permission to modify php.ini, you only need to call the time-date function when calling Date_default_timezone_set ('
PRC ')!
You can also call Date_default_timezone_get () to view the current time zone settings!
For XXX, the values available in the mainland are:
Asia/chongqing, Asia/shanghai, Asia/urumqi (Chongqing, Shanghai, Ukraine)
Available in Hong Kong and Taiwan: Asia/macao, Asia/hong_kong, Asia/taipei (Macau, Hongkong, Taipei)
Taiwan area can be set as: Date.timezone = "Asia//taipei"
and Singapore: Asia/singapore
Eight-hour solution for time difference in PHP5
After installing the PHP5, in the forum inadvertently, on the forum to see someone said php5.1.2 time shows a whole less than 8 hours,
echo Date ("y-m-d h:i:s");
?>
As a result, the test itself was 8 hours apart.
Later after the forum to find information, the results are finally resolved, in PHP5 and from the above version, to export the local time (limited to China)
, you can write code like this:
Date_default_timezone_set (' Asia/shanghai ');
echo Date (' y-m-d h:i:s ');
?>
You can also write code like this:
Date_default_timezone_set (' asia/chongqing ');
echo Date (' y-m-d h:i:s ');
?>
This time difference eight hours the problem is solved!! ~~~

The above explains why the time in dingxianghuachengrenshequ php5 is not the solution to the current time, including the content of dingxianghuachengrenshequ, You want to be helpful to a friend who is interested in PHP tutorials.

  • 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.