Add 7 days to a date

KPrasanth9

New Member
Hi Team,

I have a date and i would be adding 7 days to the existing date if the resultant date is a Sunday or Saturday or any holiday it should postpone the date to Monday or a consecutive date after Sunday or holiday.

Thanks and Regards,
Prasanth
 

Sukesh Kumaru

Active Member
Hi Prashanth,

I think this is possible you go for using code stage there is a "Weekday" function vb script language, once after adding the 7 days to existing date and pass the resultant data item to this syntax, Weekday(date[,firstdayofweek]) and here it returns 1-7 where 1 means Sunday 2 means Monday and so on.
Using decision stage you can check the resultant date falls on Saturday's and Sunday's, and achieve your target but here it doesn't checks for holidays in order to achieve this collect all holidays into collection and search for that date in collection if found add plus 1 or 2 according to your requirement.

Regards,
Sukesh.
 

VJR

Well-Known Member
Hi KPrasanth9,

You can make use of the existing WORKDAY function available in Excel for this same purpose.
In the below link refer the section that says "Add Business Days Excluding Weekends And Holidays With Formula"
https://www.extendoffice.com/docume...-date-excluding-weekends-and-holidays.html#a2

- Always keep an Excel at one location for this purpose (of course you can create Excel with all these details dynamically)
- Make a list of all the holidays as shown in the above link
- In B2 cell hard code 7 because you want to add 7 days
- All you need to simply do is use 'Set Cell Value' of Ms Excel VBO and write the date from Blue Prism into cell A2
- Use 'Get Cell Value' to read the value from cell D2. (D2 should already contain the WORKDAY formula as shown)
This will be your desired expected date excluding all the weekend and holidays.

If you do not want to make use of Excel then yes you could very well write your own code using a Code stage as suggested by @Sukesh Kumaru.
 
Top