MySQL NOW()和PHP日期('c')之间的区别

时间:2022-04-02 01:27:05

What is the difference between them? If I use them both on my local machine (windows, xampp), the difference between them is one hour. Why?

它们之间有什么区别?如果我在我的本地机器(windows,xampp)上使用它们,它们之间的差异是一小时。为什么?

2 个解决方案

#1


2  

You are probably having different timezone for PHP and MySql. You need to set the same timezone for both to get the date time without any difference

您可能拥有PHP和MySql的不同时区。您需要为两者设置相同的时区以获得没有任何差异的日期时间

#2


2  

there's no difference, but you might have configured different timezones for both (or one of them doesn't use daylight saving time). please check your...

没有区别,但您可能为两者配置了不同的时区(或者其中一个时区不使用夏令时)。请检查你的......

#1


2  

You are probably having different timezone for PHP and MySql. You need to set the same timezone for both to get the date time without any difference

您可能拥有PHP和MySql的不同时区。您需要为两者设置相同的时区以获得没有任何差异的日期时间

#2


2  

there's no difference, but you might have configured different timezones for both (or one of them doesn't use daylight saving time). please check your...

没有区别,但您可能为两者配置了不同的时区(或者其中一个时区不使用夏令时)。请检查你的......