anatak Posted February 21, 2009 Share Posted February 21, 2009 Hello I am trying to have a query that selects events that are happening today. I have a event start field and an event end field. both are datetime fields the problem I have is that when I select the events with this where clause WHERE t01_01.StartDate <= '$today' AND t01_01.EndDate >= '$today' AND t05_01.Id = 2;" $today (is todays date only in a date format yyyy-MM-DD) How can I date format the StartDate and EndDate ? something like this DATE_FORMAT(t01_01.StartDate,'%M %D, %Y') in the where clause ? kind regards anatak Quote Link to comment https://forums.phpfreaks.com/topic/146212-solved-where-clause-date-out-of-date-time-field/ Share on other sites More sharing options...
mjahkoh Posted February 21, 2009 Share Posted February 21, 2009 this works. Just tested it select * from seasons_dt WHERE date_format(datefrom,'%e-%b-%Y') < now() or date_format(datefrom,'%e-%b-%Y') > now() Quote Link to comment https://forums.phpfreaks.com/topic/146212-solved-where-clause-date-out-of-date-time-field/#findComment-767642 Share on other sites More sharing options...
anatak Posted February 21, 2009 Author Share Posted February 21, 2009 thanks It works as it should now. topic closed Quote Link to comment https://forums.phpfreaks.com/topic/146212-solved-where-clause-date-out-of-date-time-field/#findComment-768055 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.