w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to get the total hr from start time to end time using 12 Hour Format in php

You can try like this:

$start = new DateTime('01:00:00 PM');
$end = new DateTime('02:00:00 PM');
$diff = $start->diff($end);
echo $diff->format('%H'); 

You can get more info: http://in1.php.net/manual/en/datetime.diff.php

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.