bob_the _builder Posted December 15, 2011 Share Posted December 15, 2011 Hi, How can I check mysql date/time field for all records with tommorows date.. ? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/253256-select-tomrows-date/ Share on other sites More sharing options...
xyph Posted December 15, 2011 Share Posted December 15, 2011 You want to use a mix of NOW() and DATE_ADD() http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-add Quote Link to comment https://forums.phpfreaks.com/topic/253256-select-tomrows-date/#findComment-1298251 Share on other sites More sharing options...
bob_the _builder Posted December 16, 2011 Author Share Posted December 16, 2011 Hey, From my understanding this should work.. SELECT * FROM timeslots WHERE timeslot = NOW(DATE_ADD(timeslot, INTERVAL 1 DAY)) But it returns no rows and no errors.. Is there a problem with the fact the field is formated DATE/TIME aposed to DATE? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/253256-select-tomrows-date/#findComment-1298463 Share on other sites More sharing options...
xyph Posted December 16, 2011 Share Posted December 16, 2011 NOW() isn't supposed to take arguments. Quote Link to comment https://forums.phpfreaks.com/topic/253256-select-tomrows-date/#findComment-1298469 Share on other sites More sharing options...
Deoctor Posted December 16, 2011 Share Posted December 16, 2011 try this select date_format(CURRENT_TIMESTAMP() + interval 1 day,'%Y-%m-%d %H:%i:%S') as tomorrow; you can use this without the date_format if you like to get exactly the same format as now(). like this select (CURRENT_TIMESTAMP() + interval 1 day); Quote Link to comment https://forums.phpfreaks.com/topic/253256-select-tomrows-date/#findComment-1298492 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.