我想从数据库中获取时间然后用它来与当前时间进行比较。我该怎么办?
$timeStart = $row['timeStart'];
echo 'Time Start : '.$timeStart;
echo "</br>";
$time_offset =ICT; // Change this to your time zone
$time_a = ($time_offset * 120);
$time = date("M-d-Y H:i:s",time() + $time_a);
echo 'Current time is : '.$time;
echo "</br>";
if ($timeStart + $timeForEachDownload > $time) $totalDownload = $totalDownload + 1;
答案 0 :(得分:1)
改变这个:
if ($timeStart + $timeForEachDownload > $time)
$totalDownload = $totalDownload + 1;
对此:
if ((strtotime($timeStart) + strtotime($timeForEachDownload)) > $time)
$totalDownload = $totalDownload + 1;