Php time zone problems

Source: Internet
Author: User
Php is newly installed for the php time zone. date (& quot; Y-m-dH: I: s & quot;); is used to get an 8-hour shorter time than the actual time zone. Obviously, this is a problem with the time zone. how can we adjust it? Method 1: in the php. ini file, modify the settings to find the date. timezone item and modify it to set the date. timezone = Asia/Shanghai using the cgi-side php time zone.

Php is installed.

Date ("Y-m-d H: I: s ");
The resulting time is 8 hours less than the actual time. Obviously, this is a problem with the time zone. how can we adjust it?

Method 1
Modify settings in the php. ini file
Locate the date. timezone item and modify its settings.

Date. timezone = Asia/Shanghai
If you run php in cgi mode, remember to restart apache configuration to take effect.


Method 2

If you have permissions or other issues, you can set them in the PHP code.

 



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.