Jump to content

Time Calculation


Pilli

Recommended Posts

I have a form where I put in start time and end time
eg

$start= 11:00;
$end=16:30;

What i would like to do is get the total number of hours
eg. total hours between 11:00 and 16:30

I tried

$difference= $end-$start;
echo "$difference";


but I get the answer 5 when it should be 5:30

I think I should be using the date function but not sure how to subtract two times. A point in the right direction would be most appreciated.
Link to comment
https://forums.phpfreaks.com/topic/7279-time-calculation/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.