finding out difference between two times

前端 未结 7 2062
醉话见心
醉话见心 2021-01-14 04:03

I wrote the following code to determine the amount of time that employees spend on a task:

$time1 = $row_TicketRS[\'OpenTime\'];
$time2= $row_TicketRS[\'Clos         


        
7条回答
  •  一个人的身影
    2021-01-14 04:25

    A better way is to use http://php.net/manual/en/datetime.diff.php

    $start_t = new DateTime($start_time);
    $current_t = new DateTime($current_time);
    $difference = $start_t ->diff($current_t );
    $return_time = $difference ->format('%H:%I:%S');
    

提交回复
热议问题