Home > Backend Development > PHP Tutorial > Regarding the weird 6-hour time difference issue in Php timestamps during development

Regarding the weird 6-hour time difference issue in Php timestamps during development

WBOY
Release: 2016-07-28 08:28:06
Original
1167 people have browsed it

Regarding the weird 6-hour time difference issue in Php timestamps during developmentRecently I developed a Jian 3 818 and Tree Hole reading website using Php crawler

I found an extremely weird problem when using filemtime to get the last modification time of a file

For example, I am in 2016- The file was modified at 7-3 10:00:00, but the time obtained using filemtime was bad. 2016-7-3 4:00:00

Why is there such a weird time difference of 6 hours?

= = After checking, I found out that it is a time zone problem. You can change it in the configuration file, or you can add

date_default_timezone_set("Asia/Shanghai"); //The time zone is Asia Shanghai

I forgot which place the default time zone is, anyone who is interested can check it

The above has introduced the weird 6-hour time difference problem in Php timestamps during development, 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