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? 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? 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? 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 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? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.