monkeypaw201 Posted July 30, 2008 Share Posted July 30, 2008 I have a database with a time column where i insert the time using the date("now") function.... I need to be able to add 24 hours... Using that new variable i need to find out if that date/time has already passed or not. So.. 1. How do I add 24 hours? 2. Will $added_time < $date("now) work for an if..else? Quote Link to comment Share on other sites More sharing options...
Jabop Posted July 30, 2008 Share Posted July 30, 2008 I believe it's something like DATE_ADD(CURDATE(), INTERVAL 1 DAY) This is MySQL, not php () Quote Link to comment Share on other sites More sharing options...
.josh Posted July 30, 2008 Share Posted July 30, 2008 Dunno how you plan on retrieving this date in question, but assuming you have an id associated to it in the row... // important thing here is to get the date, so do whatever you got to do to get it $sql = "select datecolumn from table where id = '$id'"; $result = mysql_query($sql); if ($result) { $date = mysql_result($result, 0, 0); $date = strtotime($date) + 86400; if ($date > time()) { // do something } } 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.