我的问题如下:当我存储一个 DateTime 然后检索它并执行一些经过的函数以了解我存储该 DateTime 的时间时,我得到大约 7200 秒的偏移量,即 2 小时。我在法国,所以我猜它类似于 GMT +2(+1 小时 +1 夏令时)。
我怎样才能解决这个问题?与设置/获取时区有关,但我不确定该怎么做 感谢您的帮助
我用php5.3;mysql 5.05
在 php 中,您可以使用:date_default_timezone_set ( string $timezone_identifier )
设置 timezoen
http://php.net/manual/en/function.date-default-timezone-set.php
在mysql中,看看:http ://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html