PHP Date get time is incorrect how to do _php Foundation

Source: Internet
Author: User
Tags greenwich time zone
Today, when the Echo $showtime =date ("y-m-d h:i:s") Gets the system time, it is found that the time obtained does not match the time of the system.

Research has found that the PHP default setting time is based on Greenwich time zone, so we have to change the time zone of PHP to Beijing Times.

Action method:

Open the php.ini file, usually under the installation root directory of PHP
To find one of them; Date.timezone.
Remove the semicolon from the front of the date.timezone and change it to Date.timezone = PRC
Save and restart the Apahce service (sometimes there is a problem with the Apache Restart feature, it is recommended to stop and then start)
Let's re-examine the Echo $showtime =date ("y-m-d h:i:s").

Is the time back to normal?

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.