Answers for "how to difference hour in laravel"

PHP
1

laravel difference between current time and created time

#1 -> 10 minutes after
$lifeSpan = $now->diffForHumans($token->created_at);
#2 -> "00:10:30 Minutes"
$lifeSpan = $now->diff($token->updated_at)->format('%H:%I:%S')." Minutes";
Posted by: Guest on August-19-2021
0

difference in minutes between 2 time inputs laravel

$checkTime = strtotime('09:00:59');
echo 'Check Time : '.date('H:i:s', $checkTime);
echo '<hr>';

$loginTime = strtotime('09:01:00');
$diff = $checkTime - $loginTime;
echo 'Login Time : '.date('H:i:s', $loginTime).'<br>';
echo ($diff < 0)? 'Late!' : 'Right time!'; echo '<br>';
echo 'Time diff in sec: '.abs($diff);

echo '<hr>';

$loginTime = strtotime('09:00:59');
$diff = $checkTime - $loginTime;
echo 'Login Time : '.date('H:i:s', $loginTime).'<br>';
echo ($diff < 0)? 'Late!' : 'Right time!';

echo '<hr>';

$loginTime = strtotime('09:00:00');
$diff = $checkTime - $loginTime;
echo 'Login Time : '.date('H:i:s', $loginTime).'<br>';
echo ($diff < 0)? 'Late!' : 'Right time!';
Posted by: Guest on December-12-2020

Code answers related to "how to difference hour in laravel"

Browse Popular Code Answers by Language