I have two strings containing time, like this:
'ftime1' => string '17:44' (length=5)
'ftime2' => string '18:19' (length=5)
I need to calculate the difference between frime2 and ftime1, so result is in minutes.
I have tried
$struct[$i]['ttime'] = time($struct[$i]['ftime2']) - time($struct[$i]['ftime1']);
$struct[$i]['ttime2'] = strtotime($struct[$i]['ftime2']) - strtotime($struct[$i]['ftime1']);
$struct[$i]['ttime3'] = $struct[$i]['ftime2'] - $struct[$i]['ftime1'];
Which result in:
'ttime' => int 0
'ttime2' => int 2100
'ttime3' => int 1
strtotimeconverts string into timestamp which is on seconds..so the difference will also be in seconds..do/ 60for minutes..and time function does not behave that way, it returns current Unix timestamp, and doesn’t take any argument..