开发者

Timestamp intervals processed by date() don't calculate correctly

I have two unix timestamps in my database that I am subtracting to get a time interval in seconds:

$interval = $array["time2"] - $array["time1"]; // 开发者_如何学GoWhen echoed, $interval = 3

However, when I run this $interval through date(), like so:

echo date("g\h i\m", $interval);

these 3 seconds all of a sudden echo to:

7h00m

Does anyone have any idea why date() might be taking these three seconds and stretching them out into a 7 hour interval somehow?


The second argument to date() is a timestamp (seconds since midnight, Jan 1, 1970 GMT). Your interval is probably equating to 7am in your timezone relative to this date.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜