开发者

Get time from database and compare

开发者 https://www.devze.com 2023-01-26 08:40 出处:网络
I want to开发者_JS百科 get time from database then use it to compare with current time. How can i do it?

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;
0

精彩评论

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