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 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. 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") ); 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. 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'"; 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
Archived
This topic is now archived and is closed to further replies.