tobeyt23 Posted August 17, 2017 Share Posted August 17, 2017 I have a table with status in or out and then a timestamp. How can i calculate the time difference between them? Quote Link to comment Share on other sites More sharing options...
ginerjm Posted August 17, 2017 Share Posted August 17, 2017 Um, difference between them what? Quote Link to comment Share on other sites More sharing options...
Sepodati Posted August 17, 2017 Share Posted August 17, 2017 By "table", do you mean a database? Which one and what format is the timestamp column in? How do you want the difference displayed? If this is for work, I assume you'd want the difference in hours, right? Can the difference be calculated in the query (assuming a database) if there's a way to do that? Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted August 17, 2017 Share Posted August 17, 2017 You could also check out the Date/Time functions available through PHP. http://php.net/manual/en/book.datetime.php Quote Link to comment Share on other sites More sharing options...
ginerjm Posted August 17, 2017 Share Posted August 17, 2017 Apparently I didn't see what others are assuming - you want to compare successive (?) rows of your table to see what the difference is between them. Or is it more complicated in that you want to sort the rows and compare more than just the prior or next row to another row? Or do you want the total range from highest to lowest timestamps? Or..... How about letting us know? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.