PHP About Time zone issues

Source: Internet
Author: User
Recently in the process of learning PHP found PHP format timestamp 8 hours later than Beijing time, internet search found that the original time zone is not correct, the solution is:

1. Permanent modification

Change Data.timezone in php.ini file = PRC This is China time. The Apache service is restarted after the operation.

2. Temporary modification

Add Ini_set (' Date.timezone ', ' Asia/shanghai ') before using the formatted input time;

or Data_default_timezone_set (' PRC '); the//date_default_timezone_set () function sets the default time zone for all date/time functions used in the script.

The above describes the PHP on the time zone problem, including the aspects of the content, I hope the PHP tutorial interested in a friend helpful.

  • Related Article

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