Home > Backend Development > PHP Tutorial > 请问前辈时间戳用php转换成日期和用mysql函数转换成日期不一致的有关问题

请问前辈时间戳用php转换成日期和用mysql函数转换成日期不一致的有关问题

WBOY
Release: 2016-06-13 11:39:38
Original
1059 people have browsed it

请教前辈时间戳用php转换成日期和用mysql函数转换成日期不一致的问题
mysql数据库有一表infor,该表下有一字段为time字段,类型为int(10),该字段下有一条数据位:1383346800


问题来了:
我用php函数echo date("Y-m-d H:i:s",1383346800);  运行结果是:2013-11-01 23:00:00

而用mysql函数select from_unixtime(1383346800);   运行结果是:2013-11-02 07:00:00
如图:


为何同一个时间戳php和mysql是两个结果?哪个结果才是对的? 求前辈帮看下,两种方法我都需要,因为我要用这两个方法比较结果,能让两种结果一致吗,还是就是不能? 感谢好心人帮我了!

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