【发布时间】:2011-08-08 18:27:29
【问题描述】:
基本上这些东西让我很沮丧,我是编程新手,所以如果我问了一个愚蠢的问题,我深表歉意。
我有一个 MySQL time() 存储在我的数据库中。我想将此时间添加到当前时间,以建立目标时间。
$duration 是 06:00:00。 (MySQL时间)
$length = strtotime($duration);
$timestart = time();
$target = $length + time();
// merely to check if im getting correct values.
echo "</br>duration: ".date('G:i:s', $length)."<br/>";
echo "current time:".date('G:i:s', $timestart)."<br/>";
echo "target time:".date('G:i:s', $target)."<br/>";
目前我得到了这个(不是增加 6 小时):
持续时间:6:00:00
当前时间:15:51:44
目标时间:19:51:44
谁能帮我解释一下。
非常感谢,
【问题讨论】: