【发布时间】:2014-10-21 19:57:14
【问题描述】:
我正在使用此代码从时间戳减去 48 小时
echo date($result2["datetime"], strtotime("-48 hours"));
这很好用,我想加 48 小时,我试过了:
echo date($result2["datetime"], strtotime("+48 hours"));
我回显了$result2["datetime"];,它以Y-m-d H:i:s 格式显示时间戳
当我使用时:
echo date('Y-m-d H:i:s', strtotime("+48 hours"));
这也增加了 48 小时的罚款
当我使用时
echo date($result2["datetime"], strtotime("+48 hours"));
它只是回显从 $result2["datetime"]; 返回的相同时间戳,而不是 +48 小时
【问题讨论】:
-
看起来像是来自数据库,所以也可以是 mysql 中的圆顶。格式化和减法