php - Why do I get unexpected hour when substracting two times -


i have simple function subtract time: input values are:

$current = '23:48:32'; $arrival = '23:41:48';  $time = date( "h:i:s", strtotime($current) - strtotime($arrival)); $waitingtime = $time; // 21:06:44 

looks diff minutes correct, not sure why getting 21 in front of minutes. should 00:06:44. appreciated. thank you.

try using gmdate()

$time = gmdate( "h:i:s", strtotime($current) - strtotime($arrival)); 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -