Home > Backend Development > PHP Tutorial > PHP about time zone issues

PHP about time zone issues

WBOY
Release: 2016-08-08 09:20:29
Original
919 people have browsed it

Recently, while learning PHP, I found that the formatted timestamp in PHP is 8 hours later than Beijing time. After searching online, I found that the time zone is wrong. The solution is:

1. Permanently modify

Change the php.ini file data.timezone = PRC This is China time. It will take effect after restarting the Apache service.

2. Temporary modification

Before using formatted input time, add ini_set('date.timezone','Asia/Shanghai');

or data_default_timezone_set('PRC');//date_default_timezone_set() function setting Default time zone for all date/time functions in scripts.

The above introduces PHP's time zone issues, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

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