Can somebody tell if my below code is correct.I calculate difference between date requested and current time.But I'm getting the $timediff
value in negative like this: -28200
$dateRequest = "2015-08-21 15:16:02";
date_default_timezone_set("Asia/Kuala_Lumpur");
echo "now ".$now=date('Y-m-d, g:i A',time());
$timezone_offset = +8;
echo "then ".$then=date('Y-m-d, g:i A', strtotime($dateRequest)+$timezone_offset*60*60);
echo "<<".$timediff = strtotime($now) - strtotime($then);// in seconds
if($timediff > 120)// 120 is 2 mins
{
echo "Expired Link";
}