first of all i know that this has been asked before, and there are some really good answers, but not 100% correct, since my reputation is low I can't post comments.
My question is how to add days in MySQL excluding weekends, for example
the day 1/8/2018 if we add 20 days the results should be 1/29/2018, most of the forum answers are like the following
Expected Date,DATE_FORMAT( DATE_ADD(
Expected Date +
StartDate) <> WEEK(DATE_ADD(
Expected Date DAY)))
Expected Date DAY)) IN (5, 6)),
Expected Date >0, 2, -2 ),
) , '%y-%m-%d') as FinalDate from
THIS WORKS but for low numbers where it will encounter just one weekend, I do change the formula to accept minus add days.
I know the tricky part is around IF(
Expected Date >0, 2, -2 ), where it add or delete more days if its weekend, but cant find a way to figure it out if there are more than 1 weekend in between.
i hope I make my self clear and some could help me.
Similar post but not 100% right