Get time from database and compare
I want to开发者_JS百科 get time from database then use it to compare with current time. How can i do it?
$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;
Change this:
if ($timeStart + $timeForEachDownload > $time)
$totalDownload = $totalDownload + 1;
To this:
if ((strtotime($timeStart) + strtotime($timeForEachDownload)) > $time)
$totalDownload = $totalDownload + 1;
精彩评论