1. Arun

    On the same principles, in DaysToAdd we could also do:

    int n=(d-c);
    if (n<=0) n+=7;

  2. Steve

    Thank you so much for this solution! Works great!

  3. Filippos

    Great article, thanks!

  4. Eric

    I too am glad you were inspired to figure this out. I was feeling far too lazy to do it myself!

  5. Kim Tranjan

    awesome, thank you!!!

  6. Jorge

    I was about to give up looking for a non loop solution to this but fortunately I found your post.
    I only use Part1 of your solution ’cause I need to find out next desired day but not in the same week.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>