jbwebdesign Posted August 13, 2012 Report Share Posted August 13, 2012 Hello, I have been trying to figure out How to calculate the amount of HOURS remaining between 2 datetime fields in MySQL. Can someone please help me ..... I am trying to do something like this: <?php $datetime1 = "2012-08-06 08:46:00"; //this is the later date $datetime2 = "2012-08-05 08:45:00"; //this is the earlier date //I want to return the difference between $datetime1 and $datetime2 in HOURS, MIN, and SECONDS remaining. ?> Quote Link to comment Share on other sites More sharing options...
falkencreative Posted August 13, 2012 Report Share Posted August 13, 2012 You might start researching here: http://stackoverflow.com/questions/432398/phpcalculate-time-difference-between-two-dates-and-present-the-answer-like-2 Also, if you are running PHP5, check out http://php.net/manual/en/datetime.diff.php 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.
Note: Your post will require moderator approval before it will be visible.