I want to select date after 2 days but don't want to count Saturday and Sunday. Here is my current query which picks date simply after 2 days. SELECT DATE_ADD('2006-05-00',INTERVAL 2 DAY); Code (markup): I want it to exclude Saturday and Sunday if Saturday and Sunday is coming it should cross 2 days. thank you
Why not do the date element before passing it to the SQL? Alternatively have a stored proc/ function that checks the day of the week first, if it is a Thurs or Fri or Sat add the appropriate number of days if it is Sun, Mon, Tues then add 2 days. Once you have the date feed it into the sql query
Does anyone know why any of the date MySQL statements are any better than a unix timestamp? Unix timestamps are sooooo much easier to work with...
SELECT case weekday(now()) when 3 then DATE_ADD(now(),INTERVAL 4 DAY) when 4 then DATE_ADD(now(),INTERVAL 3 DAY) else DATE_ADD(now(),INTERVAL 2 DAY) end; Code (markup): returns next Monday if current day is Thursday or Friday, else returns a date that is 2 days away. any good this one ?