PHP错误的日期/时间 [英] PHP wrong date/time

查看:133
本文介绍了PHP错误的日期/时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PHP date()& time()返回不正确的时间:

PHP date() & time() return incorrect time:

date.timezone =欧洲/里加 date()返回的时间是 03-12-2011 08:57:12 ,但系统时间为 03-12-2011 01:57:12 (时区欧洲/里加 - 那时的正确时间)。
当我将时区改为欧洲/伦敦时,时间更改为 03-12-2011 06:57:12 (实际时间 02-12-2011 23:57:12

When date.timezone = "Europe/Riga" the time returned by date() was 03-12-2011 08:57:12, but system time was 03-12-2011 01:57:12 (timezone Europe/Riga - correct time at that moment). When I changed timezone to "Europe/London", the time changed to 03-12-2011 06:57:12 ( actual time 02-12-2011 23:57:12 )

date返回的时间 / hwclock --show 是正确的( 03-12-2011 01:57:12 系统时区设置为里加)

Time returned by date / hwclock --show was correct (03-12-2011 01:57:12 with system timezone set as Riga)

操作系统:Debian 6.0

OS: Debian 6.0

我已经检查了大部分有关SO / Google类似问题的问题,但是他们似乎都有错误的时区指定。

I have checked most of the questions regarding similar issues on SO/Google, but they all seem to have wrong timezone specified.

据我所知,php - > os有问题。
当然,因​​为错误的时间偏移总是不变的,我可以减去差异,但这不是一个正确的解决方案。

As far as I can tell there is problem between php -> os. Of course, because the incorrect time offset is always constant I could subtract difference, but it is not a proper solution.

任何想法都将不胜感激。

Any ideas will be greatly appreciated.

推荐答案

这个问题看起来和我在其中一个服务器上看到的一样。看起来像 php 5.3.2-1中的错误。尝试在错误报告中运行php脚本并发布结果。

The problem looks similar to what I have seen on one of my servers. Looks to like bug in php 5.3.2-1. Try to run the php script in the bug report and post your results.

这篇关于PHP错误的日期/时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆