📅  最后修改于: 2022-03-11 14:48:18.680000             🧑  作者: Mango
$checkTime = strtotime('09:00:59');
echo 'Check Time : '.date('H:i:s', $checkTime);
echo '
';
$loginTime = strtotime('09:01:00');
$diff = $checkTime - $loginTime;
echo 'Login Time : '.date('H:i:s', $loginTime).'
';
echo ($diff < 0)? 'Late!' : 'Right time!'; echo '
';
echo 'Time diff in sec: '.abs($diff);
echo '
';
$loginTime = strtotime('09:00:59');
$diff = $checkTime - $loginTime;
echo 'Login Time : '.date('H:i:s', $loginTime).'
';
echo ($diff < 0)? 'Late!' : 'Right time!';
echo '
';
$loginTime = strtotime('09:00:00');
$diff = $checkTime - $loginTime;
echo 'Login Time : '.date('H:i:s', $loginTime).'
';
echo ($diff < 0)? 'Late!' : 'Right time!';