weekdays' duration using boost date

后端 未结 2 1633
野趣味
野趣味 2021-01-15 03:16

Is there a way to get only the no. of weekdays between 2 boost dates.

In the following, I\'m only getting calendar days.

date begin_dt(2011,Aug,3);
         


        
2条回答
  •  囚心锁ツ
    2021-01-15 03:51

    You could start substracting the number of days to the next week start, and deleting either 1 or two depending if you're on saturday or before, or sunday. Then, you can divide the rest of the days remaining by 7, multiply that number by 2, and substract to the days. You have to make a case for the remainder too. If it is 6 (saturday), you have to remove one more. Not easy, but you get the idea.

提交回复
热议问题