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
https://forums.phpfreaks.com/topic/57721-doing-math-with-timestamp/
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.