How to create tomorrow's date (should be weekdays) according to weekend and holidays

How can i create a date time algorithm which consist tomorrow date format like (26.05.2021). But i will need that also if tomorrow is weekend the variable should be next Monday and if Monday is not working day (holiday) the date variable should be next working day. and if tomorrow is a set of holiday (not working days) ( robot will run in Turkey ) the date variable should be next working day. Could anyone help me build the algorithm

Set your date variable to tomorrow. Use a Do/While with a boolean variable to store whether you found a business day. As long as that variable is false, keep looping. Inside the Do/While, check if it’s a Saturday, Sunday, or Holiday. If it is not, set your “business day found” variable to true and do nothing else, the Do/While will exit. If it is a Saturday, Sunday, or Holiday, add one day to the date and check again by leaving the “business day found” variable false.

1 Like

It would be better you maintain a calendar and upload it on orchestrator

And how do you use that within your code?

1 Like

he is asking about the run the robot which will scheduled by Orch only

Hi @Arif_Kilic

Maintain a holiday excel in your system.
Read the excel.
In UiPath check the Saturday, Sunday, and Holidays using Lookup datatable, and if found AddDays by one.

Thank you,
Prashant

No. Not only for scheduling in orchestrator. I need it in Studio

Hi @Arif_Kilic,

I have taken 2021 holidays list in excel -
Holidays2021.xlsx (9.9 KB)

Try this xaml -
GetTomorrowDateWorkingDay.xaml (11.7 KB)

This will return tomorrows date as next working day by validating weekends as well as holidays list in excel.

Thanks!

2 Likes

How do you know this, since he didn’t say this?