datetime - How to get the total hr from start time to end time using 12 Hour Format in php -


how can total hour 2 given time "hh:mm:ss" format?

here code:

   $start = 01:00:00 pm;    $end = 02:00:00 pm; 

expected output:

   $total = 1; 

you can try 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 more info: http://in1.php.net/manual/en/datetime.diff.php


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -