flemingmike Posted September 7, 2011 Share Posted September 7, 2011 hi, what is the proper way to to $now $next tuesday select * where date is between now and next tuesday thx all Quote Link to comment https://forums.phpfreaks.com/topic/246594-select-where-date-is-between/ Share on other sites More sharing options...
voip03 Posted September 7, 2011 Share Posted September 7, 2011 SELECT * FROM `DB_table` WHERE date BETWEEN '2011-09-01' AND '2011-09-10' There are tons of examples if you search Google. Quote Link to comment https://forums.phpfreaks.com/topic/246594-select-where-date-is-between/#findComment-1266307 Share on other sites More sharing options...
flemingmike Posted September 8, 2011 Author Share Posted September 8, 2011 perfect. is there a way to write next tuesday? $nexttuesday=date('Y-m-d g:i A', strtotime("tuesday") ); Quote Link to comment https://forums.phpfreaks.com/topic/246594-select-where-date-is-between/#findComment-1266668 Share on other sites More sharing options...
funstein Posted September 8, 2011 Share Posted September 8, 2011 strtotime("next Thursday"); That should do it. Quote Link to comment https://forums.phpfreaks.com/topic/246594-select-where-date-is-between/#findComment-1266789 Share on other sites More sharing options...
skwap Posted September 8, 2011 Share Posted September 8, 2011 i think this is you need to get // today date. $today = date('Y-m-d'); //next tuesday date. $next = date('Y-m-d', strtotime("tuesday")); //query to get the records between today & next tuesday. $sql = "SELECT * FROM `DB_table` WHERE date BETWEEN '$today' AND '$next'"; Quote Link to comment https://forums.phpfreaks.com/topic/246594-select-where-date-is-between/#findComment-1266802 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.