How do I find the next saturday in MySQL I have trigger and a stored procedure in it (so SP runs when trigger runs). I need a function which finds the next saturday to put in SP. 

So lets say, it is Wednesday (2015-7-22) today. If my trigger runs today, the SP in it must find the next Saturday (2015-7-25).

Plus, even if it is Saturday, but the time is earlier of 9.30 pm, it must find the current day also. After 9.30 pm, it must return the next Saturday.

I would like to the put my whole trigger and sp on here but I don't want to get here crowded. I just need ideas, thanks.

EDIT:

Thanks to oNaye, I coded that:

CREATE DEFINER=`root`@`localhost` PROCEDURE `newGuess`(
IN `muserID` INT, 
IN `numm1` INT, 
IN `numm2` INT, 
IN `numm3` INT, 
IN `numm4` INT, 
IN `numm5` INT, 
IN `numm6` INT)
    begin
set @today = (select weekday(curdate())+1); /*monday is the first day in here*/
if @today&lt;6 or @today=7 then /*it is NOT saturday*/
    set @nextSaturday = (SELECT DATE_ADD(NOW(),INTERVAL IF(WEEKDAY(NOW())&gt;=5,(6-WEEKDAY(NOW())),(5-WEEKDAY(NOW()))) DAY));
end if;
if @today = 6 then /* it is saturday */
    set @current_time = (select curtime());
    set @nextSaturday = (SELECT DATE_ADD(NOW(),INTERVAL IF(WEEKDAY(NOW())&gt;=5,(6-WEEKDAY(NOW())),(5-WEEKDAY(NOW()))) DAY));
    if @current_time &lt; CAST('21:30:00' AS time) then
        set @nextSaturday = curdate();
    end if;
    if @current_time &gt;=CAST('21:30:00' AS time) then
        set @nextSaturday = curdate()+INTERVAL 1 WEEK;
    end if;
end if;
insert into guessesTBL (userID,num1,num2,num3,num4,num5,num6,current__datetime,draw_date) values (muserID,numm1,numm2,numm3,numm4,numm5,numm6,NOW(),@nextSaturday);

end


It worked now. 
Solved.
You can use WEEKDAY and DATE_ADD function to calculate the next weekday incoming.

Here what you have to do:

SELECT 
  DATE_ADD(NOW(),INTERVAL IF(WEEKDAY(NOW())&gt;=5,
                             (6-WEEKDAY(NOW())),
                             (5-WEEKDAY(NOW()))) DAY);


The query meaning:

With DATE_ADD you will add an interval between the parameter NOW() and one condition assuming my weekday for Saturday is 5, you will have to evaluate if NOW() is greater than 5 or equal, you have to rest it with 6 (Sunday) and if NOW() is less than 5 you have to rest it 5 with the weekday of NOW().

Test:

mysql&gt; SELECT NOW();
+---------------------+
| NOW()               |
+---------------------+
| 2015-07-22 07:51:33 |
+---------------------+
1 row in set (0.00 sec)

mysql&gt; SELECT DATE_ADD(NOW(),INTERVAL IF(WEEKDAY(NOW())&gt;=5,(6-WEEKDAY(NOW())),(5-WEEKDAY(NOW()))) DAY);
+------------------------------------------------------------------------------------------+
| DATE_ADD(NOW(),INTERVAL IF(WEEKDAY(NOW())&gt;=5,(6-WEEKDAY(NOW())),(5-WEEKDAY(NOW()))) DAY) |
+------------------------------------------------------------------------------------------+
| 2015-07-25 07:51:34                                                                      |
+------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql&gt; 


EDIT:

If you need to calculate to get the next Saturday if the actual Saturday is at 9:30PM:

New syntax:

SET @ACTUAL_DATE=NOW();
SET @NEXT_SATURDAY=DATE_ADD(@ACTUAL_DATE,INTERVAL IF(WEEKDAY(@ACTUAL_DATE)=5 &amp;&amp; TIME(@ACTUAL_DATE)&gt;'21:30:00',
                                            7,
                                            IF(WEEKDAY(@ACTUAL_DATE)&gt;=5,
                                                (6-WEEKDAY(@ACTUAL_DATE)),
                                                (5-WEEKDAY(@ACTUAL_DATE)))) 
                                        DAY);


Today test:

mysql&gt; SET @ACTUAL_DATE=NOW();
Query OK, 0 rows affected (0.01 sec)

mysql&gt; SET @NEXT_SATURDAY=DATE_ADD(@ACTUAL_DATE,INTERVAL IF(WEEKDAY(@ACTUAL_DATE)=5 &amp;&amp; TIME(@ACTUAL_DATE)&gt;'21:30:00',
    -&gt; 7,
    -&gt; IF(WEEKDAY(@ACTUAL_DATE)&gt;=5,
    -&gt; (6-WEEKDAY(@ACTUAL_DATE)),
    -&gt; (5-WEEKDAY(@ACTUAL_DATE)))) 
    -&gt; DAY);
Query OK, 0 rows affected (0.00 sec)

mysql&gt; SELECT @NEXT_SATURDAY;
+---------------------+
| @NEXT_SATURDAY      |
+---------------------+
| 2015-07-25 21:30:01 |
+---------------------+
1 row in set (0.00 sec)

mysql&gt; 


But if we're on July 25th at 21:30:01 (Saturday):

mysql&gt; SET @ACTUAL_DATE='2015-07-25 21:30:01';
Query OK, 0 rows affected (0.00 sec)

mysql&gt; SET @NEXT_SATURDAY=DATE_ADD(@ACTUAL_DATE,INTERVAL IF(WEEKDAY(@ACTUAL_DATE)=5 &amp;&amp; TIME(@ACTUAL_DATE)&gt;'21:30:00',
    -&gt; 7,
    -&gt; IF(WEEKDAY(@ACTUAL_DATE)&gt;=5,
    -&gt; (6-WEEKDAY(@ACTUAL_DATE)),
    -&gt; (5-WEEKDAY(@ACTUAL_DATE)))) 
    -&gt; DAY);
Query OK, 0 rows affected (0.00 sec)

mysql&gt; SELECT @NEXT_SATURDAY;
+---------------------+
| @NEXT_SATURDAY      |
+---------------------+
| 2015-08-01 21:30:01 |
+---------------------+
1 row in set (0.00 sec)