radiations3 Posted August 10, 2011 Share Posted August 10, 2011 CAN WE COMPARE IN AN SQL QUERY A DATE WHICH IS STORED IN OUR DATABASE WITH THE CURRENT SYSTEM DATE (LIKE date() FUNC IN PHP) SELECT * FROM deals WHERE city = 'ILFORD' and dealtype='today' and end_date<date(Y/m/d) Quote Link to comment https://forums.phpfreaks.com/topic/244416-easry-question-of-the-day/ Share on other sites More sharing options...
kickstart Posted August 10, 2011 Share Posted August 10, 2011 Hi NOW() is the equivalent function to return the current date / time. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/244416-easry-question-of-the-day/#findComment-1255372 Share on other sites More sharing options...
Maq Posted August 10, 2011 Share Posted August 10, 2011 Yes, look in the manual for more information: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_now There are examples, explanations, etc. Quote Link to comment https://forums.phpfreaks.com/topic/244416-easry-question-of-the-day/#findComment-1255373 Share on other sites More sharing options...
radiations3 Posted August 10, 2011 Author Share Posted August 10, 2011 ONE LAST QUESTION HOW TO GET THE DATE IN THE FORMAT OF MM/DD/YYYY BECAUSE I HAVE TO COMPARE IT WITH THE MENTIONED FORMAT DATE WITH THE NOW FUNCTION Quote Link to comment https://forums.phpfreaks.com/topic/244416-easry-question-of-the-day/#findComment-1255377 Share on other sites More sharing options...
Maq Posted August 10, 2011 Share Posted August 10, 2011 ONE LAST QUESTION HOW TO GET THE DATE IN THE FORMAT OF MM/DD/YYYY BECAUSE I HAVE TO COMPARE IT WITH THE MENTIONED FORMAT DATE WITH THE NOW FUNCTION Again, in the manual - DATE_FORMAT. Why are you typing in all caps? Quote Link to comment https://forums.phpfreaks.com/topic/244416-easry-question-of-the-day/#findComment-1255378 Share on other sites More sharing options...
kickstart Posted August 10, 2011 Share Posted August 10, 2011 ONE LAST QUESTION HOW TO GET THE DATE IN THE FORMAT OF MM/DD/YYYY BECAUSE I HAVE TO COMPARE IT WITH THE MENTIONED FORMAT DATE WITH THE NOW FUNCTION Also, comparing with a date in the format MM/DD/YYYY is a pain. You will have to reformat that anyway. Better to reformat that into the mysql date format. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/244416-easry-question-of-the-day/#findComment-1255381 Share on other sites More sharing options...
radiations3 Posted August 10, 2011 Author Share Posted August 10, 2011 OK got it!!! THANX ALL!! Quote Link to comment https://forums.phpfreaks.com/topic/244416-easry-question-of-the-day/#findComment-1255385 Share on other sites More sharing options...
radiations3 Posted August 10, 2011 Author Share Posted August 10, 2011 ONE LAST QUESTION HOW TO GET THE DATE IN THE FORMAT OF MM/DD/YYYY BECAUSE I HAVE TO COMPARE IT WITH THE MENTIONED FORMAT DATE WITH THE NOW FUNCTION Again, in the manual - DATE_FORMAT. Why are you typing in all caps? TYPING DIFFERENTLY THATS ALL!! Quote Link to comment https://forums.phpfreaks.com/topic/244416-easry-question-of-the-day/#findComment-1255386 Share on other sites More sharing options...
AbraCadaver Posted August 10, 2011 Share Posted August 10, 2011 OK got it!!! THANX ALL!! GREAT! GLAD YOU GOT IT SORTED!!! Quote Link to comment https://forums.phpfreaks.com/topic/244416-easry-question-of-the-day/#findComment-1255388 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.