$start_time = '10:36:23';
$end_time = '10:36:26';
$v = strtotime($end_time) - strtotime($start_time);
echo date("h:i:s", $v);
Result should be 00:00:03. But is showing 12:00:03.
How can i resolve this?
$start_time = '10:36:23';
$end_time = '10:36:26';
$v = strtotime($end_time) - strtotime($start_time);
echo date("h:i:s", $v);
Result should be 00:00:03. But is showing 12:00:03.
How can i resolve this?
Lowercase h gives you the hour in 12-hour format. So an hour of zero is after midnight which is 12 AM. If you use uppercase H it will display as you want.
echo date("H:i:s", $v);
Your difference is not actually a time, it is a time span.