Php solves the problem of server time in the United States

Source: Internet
Author: User
: This article mainly introduces how php solves the problem of server time in the United States. if you are interested in PHP tutorials, please refer to it. The speed of foreign servers is good, and there is no need to file records or anything. However, if a problem is found in the past two days, the call output time is not correct, and it is all in the United States, this is a problem. for example, today is July 22, April 2, but the page shows July 22, April 1. this is not very good. I checked the information and found that the code is quite useful. let's share it:

$ Date = putenv ('tz = America/Chicago ');
Mktime );
Echo date ("Y-m-d H: I: s ");

Change "TZ = America/Chicago" to your local time zone, for example, "TZ = Asia/Shanghai"

The above section describes how php solves the problem of server time in the United States, including related content, and hopes to help friends who are 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.