Jabop Posted March 13, 2008 Share Posted March 13, 2008 $sql=("INSERT INTO invites (Email,Expiration) VALUES ('".DBString($_REQUEST['email'])."',NOW()+(60*60*24))"); My row, Expiration, is currently set to DATETIME, and this does not work properly. I am trying to get the date of NOW()+24 hours, and added to the record. Could anyone assist? Thanks Quote Link to comment Share on other sites More sharing options...
teng84 Posted March 13, 2008 Share Posted March 13, 2008 24 hour is one day right? then to be simple just get the date today and add one day.. $sql=("INSERT INTO invites (Email,Expiration) VALUES ('".DBString($_REQUEST['email'])."',DATE_ADD(now(), INTERVAL 1 DAY)"); Quote Link to comment Share on other sites More sharing options...
Jabop Posted March 13, 2008 Author Share Posted March 13, 2008 Thank you, that worked. I was having some difficulty prior to posting the thread, when I was working with the DATE_ADD function. I totally get it now However, I am still confused as to what I was doing wrong. Suppose I want to do a different time, based in seconds, how would I go about that? NOW()+(60*60*24) Quote Link to comment Share on other sites More sharing options...
teng84 Posted March 13, 2008 Share Posted March 13, 2008 use ADDTIME Quote Link to comment Share on other sites More sharing options...
fenway Posted March 13, 2008 Share Posted March 13, 2008 You can also use + INTERVAL X SECOND... but that's much worse, and probaly not at all what you want. 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.