php date reads incorrect time_PHP tutorial

WBOY
Release: 2016-07-13 10:53:43
Original
852 people have browsed it

php date reading time is incorrect

$DateTime = date("Y-m-d H:i:s");
echo $DateTime;
Why is the printed date inconsistent with the system time of my server? I'm testing it locally.

Configure php.ini
You can also set it directly to East Eighth District in php.ini:
Open php.ini and search for date.timezone. Remove the semicolon in front of it, add Asia/Shanghai after =, and restart apache

Set in the program

@ini_set('date.timezone','PRC');
$DateTime = date("Y-m-d H:i:s");
echo $DateTime;
That's it. Add @ini_set('date.timezone','PRC'); above to change the configuration time zone.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632372.htmlTechArticlephp date reading time is incorrect $DateTime = date(Y-m-d H:i:s); echo $DateTime; Why is the printed date inconsistent with the system time of my server? I'm testing it locally. Configure...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template