HughbertD Posted January 31, 2008 Share Posted January 31, 2008 For some reason if I do : ev_dat < current_date its not the same as; ev_dat < '2008-01-31' Infact I have to do ev_dat > '2008-01-31' to get the same result as ev_dat < current_date; Is there a known bug here? Link to comment https://forums.phpfreaks.com/topic/88699-solved-weird-and-date-problem/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 31, 2008 Share Posted January 31, 2008 What data type is ev_dat and give a specific example of a value in ev_dat that you are testing with. Link to comment https://forums.phpfreaks.com/topic/88699-solved-weird-and-date-problem/#findComment-454292 Share on other sites More sharing options...
Barand Posted February 1, 2008 Share Posted February 1, 2008 I'm going to guess that ev_dat is DATETIME and contains something like 2008-01-30 08:00:00 and if you use NOW() to get current_date and it is now 2008-01-30 12:00:00 So, ev_dat < NOW() but '2008-01-30' is equivalent to 2008-01-30 00:00:00 therefore ev_dat > '2008-01-30' If I'm right, and you are comparing datetime with date, use these DATE(ev_dat) < CURDATE() DATE(ev_dat) < '2008-01-30' Then again I'm probably way out and should just wait for more info in response to PFMaBiSmAd's post. Link to comment https://forums.phpfreaks.com/topic/88699-solved-weird-and-date-problem/#findComment-455194 Share on other sites More sharing options...
HughbertD Posted February 1, 2008 Author Share Posted February 1, 2008 Sorry for the lack of response. Turns out I was passing the ev_dat from a form without ' ' marks.I put $_POST[ev_dat] in the single quotes and it works as normal Thanks for the help everyone Link to comment https://forums.phpfreaks.com/topic/88699-solved-weird-and-date-problem/#findComment-455314 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.