I'm working on the employee management system where i want to calculate employee late hour after after employee punch in?

For Example

ABC Employee 

Shift Start At : 01:00:00 PM
Shift End   At : 09:00:00 PM
Employee Punch Timing At: 02:30 PM

Now how i calculate employee late hour ?

Php Code

date_default_timezone_set('Asia/Karachi');
$startworkingtime = strtotime('2018/12/3 01:00:00 PM');
$endworkingtime = strtotime('2018/12/3 09:00:00 PM');
$employeecheckintime = strtotime('2018/12/3 02:30:00 PM');

$delta_T = ($endworkingtime- $startworkingtime);
$totallate = $employeecheckintime - $delta_T;   
$hours = round((($delta_T % 604800) % 86400) / 3600); 
$minutes = round(((($delta_T % 604800) % 86400) % 3600) / 60); 
$sec = round((((($delta_T % 604800) % 86400) % 3600) % 60));

echo "Time difference: ".$hours. ' Hours '. $minutes. ' Minutes ' . $sec . ' Seconds ' ."  ";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.