Set date to 7 working days from today (excluding weekends and public holidays)

后端 未结 3 1417
日久生厌
日久生厌 2021-01-24 08:30

I\'m trying to set a date to 7 working days from today\'s date (excluding weekends and UK public holidays).

  1. I start by setting the default date to today\'s date (t
3条回答
  •  一向
    一向 (楼主)
    2021-01-24 09:26

    Check one day at a time instead of a 7 day range.

    Start by setting the default date to today's date. Then, check one day at a time into the future. If that day is a working day, increment the workingDay counter by 1. if it's not, just loop onto the following day. When your workingDay counter hits 7, that's the date you need.

提交回复
热议问题