Jump to content

Archived

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

Pilli

Time Calculation

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.

Share this post


Link to post
Share on other sites
[a href=\"http://us2.php.net/manual/en/function.time.php\" target=\"_blank\"]http://us2.php.net/manual/en/function.time.php[/a]

Share this post


Link to post
Share on other sites

×

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.