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.
Thanks