PHP solves the problem of 8 hours of time difference

Source: Internet
Author: User
Sometimes use phpechodate (Y-m-dH: I: s) you will find that your time is different from the system time. This problem is generally caused by the difference between your own time zone and the configured time zone: There are three ways to modify php. ini, add the following content: [Date]; definesthedefatimetimezoneusedbythedat

Sometimes php echo date ("Y-m-d H: I: s ") you will find that your time is different from the system time. This problem is generally caused by the difference between your own time zone and the configured time zone: There are three ways to modify php. ini, add the following content: [Date]; Defines the default timezone used by the dat

Sometimes phpEcho date ("Y-m-d H: I: s"), you will find that your time is different from the system time.

HereProblemThis is generally because of the difference between your own time zone and the configured time zone:

SolutionThere are three methods

Modify php. ini and add the following content:
[Date]
; Defines the default timezone used by the date functions
Date. timezone = Asia/Chongqing

The Time Zone in your php. ini is not local.

You are here
; Date. timezone
Change
Date. timezone = "PRC"

Or other methods

Time ZoneProblem
Modify in php. ini

Or
Add at the beginning of the file

Ini_set ("date. timezone", "Asia/Chongqing ");

========================================================== =====

@ Ini_set ("date. timezone", "Asia/Shanghai ");

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.