Jump to content

[SOLVED] Help trying to work something out


onlyican

Recommended Posts

Hey all.

 

Been a while.

Here is the situation.

 

I am storing someones Start and Finish time for work in the database using strototime()

So I have the date.

 

TO work out the number of hours they have worked that day is simple

$DiffTime = ($FinishTime - $StartTime);
//For some reason, above adding an hour. remove this
$DiffTime = strtotime("-1 hour", $DiffTime);
//Show results as wish
return date("G", $DiffTime)." hours ".date("i", $DiffTime)." mins";

 

Now here is the tricky bit.

 

I want to somehow work out how many hours in total they have done.

 

Any suggestions?

Link to comment
https://forums.phpfreaks.com/topic/88177-solved-help-trying-to-work-something-out/
Share on other sites

You mis-understood, I got the time for that day in the example

but say I have 4 days

If I add all the Start Times up, I could run into problems

The only thing I can think off is adding up the Hours and Minutes

 

Then what do I do when I have 200 minutes.

We know its 3 hours 20 mins, but How do I get the 20 minutes?

 

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.