Skip to main content
Known Participant
October 15, 2011
Answered

Filter recordset by date interval?

  • October 15, 2011
  • 1 reply
  • 1075 views

I have a php page that displays "orders" from a mySql database. Each order has a field named "weekof" which represents the week during which it will be processed. The value for this field is the date of the monday of that week in m/d/Y format. I want to filter the record set so that when the date() is within the interval of moday to sunday all the records for that week will be displayed. Any idea of where to go or how to possibly do this is greatly appreciated. If I didn't explain the problem well enough please let me know and I will try to clear up whatever I can. Thanks again...

This topic has been closed for replies.
Correct answer bregent

Try:

Select * from MyTable where DATE_FORMAT(weekof, '%x %v') = Date_FORMAT (CURDATE(), '%x %v')


1 reply

bregentCorrect answer
Participating Frequently
October 16, 2011

Try:

Select * from MyTable where DATE_FORMAT(weekof, '%x %v') = Date_FORMAT (CURDATE(), '%x %v')


Known Participant
October 17, 2011

That worked great thanks so much for the help.