liamloveslearning Posted May 20, 2010 Share Posted May 20, 2010 Hi everybody, I need to call all data from the db where records were added between the monday of the current week and the friday of the current week. Can anybody advise me on how this is done? Or if the function has a specific name? Quote Link to comment https://forums.phpfreaks.com/topic/202361-query-results-from-monday-to-friday-current-week/ Share on other sites More sharing options...
liamloveslearning Posted May 20, 2010 Author Share Posted May 20, 2010 can the current week number variable help me achieve this? ie <?php $weekNumber = date("W"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/202361-query-results-from-monday-to-friday-current-week/#findComment-1061038 Share on other sites More sharing options...
phpchamps Posted May 20, 2010 Share Posted May 20, 2010 Below is the query. My My Case , add_date is the date column which store date in 'YYYY-MM-DD' format SELECT * FROM gp WHERE WEEKDAY(add_date) >= 0 AND WEEKDAY(add_date) <= 4 AND WEEK(add_date) = WEEK(NOW()) Quote Link to comment https://forums.phpfreaks.com/topic/202361-query-results-from-monday-to-friday-current-week/#findComment-1061045 Share on other sites More sharing options...
ignace Posted May 20, 2010 Share Posted May 20, 2010 WHERE week(date_post) = week(CURRENT_DATE) AND dayofweek(date_post) BETWEEN 2 AND 6 Quote Link to comment https://forums.phpfreaks.com/topic/202361-query-results-from-monday-to-friday-current-week/#findComment-1061058 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.