Jump to content

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?

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.