Jump to content

Doing Math with Timestamp


jester626

Recommended Posts

OK, got a DB with TimeIn and TimeOut Fields, they are set up as INT and am using strtotime when these fields are populated.

 

I can get the math to find out the amount of time allotted between the two times

 

<SNIPPET>

$doseconds = $row_getLastPunch['TimeOut'] - $row_getLastPunch['TimeIn']

</SNIPPET>

 

Now I know to take the number and divide by 60 to get the minutes, and then another 60 to get the hours.

 

here  is where my problem starts and my skill level stops.

 

Say I have a final answer that breaks down to 98 minutes (5880 seconds) when I go to get the hours (98 divide by 60) I get '1.6333~ hours' which is correct math, I would rather it display '1:38 hours'  or something close to that.  Any help and assistance would be greatly appreciated.

 

 

Jester

 

Link to comment
Share on other sites

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.