How to get the holidays with VB in uipath?

hi guys, im developing a automatitation that gets all the laboral days and holidays, im already get the laboral days (Monday to friday), but, i want to know a easy way to get the holidays, my idea is to create an array where i can paste all the dates and go through arrangement and check my execution date if is inside of my array.
any idea??
Thanks for the help.
Regards.

@Jonga2018, This helps you if you follow the whole thread,

Indentify the previous business day - #5 by Windell

Regards,
Dom :slight_smile:

1 Like

Hi @Jonga2018,
Please refer below xaml file to get last working day.
Main.xaml (13.5 KB)

dateFrom->Date
DayOfWeek weekDay = dateFrom.DayOfWeek
Use If Condition to check weekend
weekDay = DayOfWeek.Saturday or weekDay = DayOfWeek.Sunday

Regards,
Arivu :slight_smile:

1 Like

Thank you for the quick response, it works but i want to know if there is a function that do that automatically.

i think no, but you can do using for Each activity to loop through and using if condition to get the result.

1 Like

thanks for the advice.

Hi,
I’m not sure there’s a good way to get all the “business” holidays without having some list of dates in a file already. So let’s assume you create an array (or even a table) that contains all holiday dates.

What you can do is use the .IndexOf() or .Contains() to see if the current date is in that list.

arrayHolidays.Contains(Now.ToString("MM/dd/yyyy"))

or

Array.IndexOf(arrayHolidays,Now.ToString("MM/dd/yyyy")) > -1

For a table you could use something like

dtHolidays.AsEnumerable.Where(Function(r) r(0).ToString.Trim = Now.ToString("MM/dd/yyyy")).ToArray.Count > 0

There might be better ways than this though.

Regards

1 Like

We use excel to do this and have it in a location all robots can access, but would love other suggestions if there are better ways.

We have 2 separate files, one for the bank business day and one for our own business day. They’re different due to the holiday differences. The holiday dates need to be input manually each year and we have 2 years worth of data (as company has floating holidays that aren’t known until close to the new year)

Then each workflow simply grabs the current date and previous date using excel scope for use within the workflow. I attached a copy of the bank holiday schedule to take a look

WorkDayScheduleBank.xlsx (9.6 KB)

1 Like