Check if it is the first working day of the month

good evening
please, could you help me,
I need a way to check if it is the first working day of the month

1 Like

Hi, i hope you are using the regular Studio and not StudioX, a working day can have different meaning to you, but you could use code like this:
'start by getting the first day of this month
Dim firstDay As Date = New Date(Now.Year, Now.Month, 1)

    'what day is the first of this month
    Dim dOw As DayOfWeek = firstDay.DayOfWeek

    'add 2 days if the first is a saturday
    'add 1 day if it is sunday
    'otherwise the first is the first week day
    Dim firstWeekDayDate As Date
    If dOw = DayOfWeek.Saturday Then
        firstWeekDayDate = firstDay.AddDays(2)
    ElseIf dOw = DayOfWeek.Sunday Then
        firstWeekDayDate = firstDay.AddDays(1)
    Else
        firstWeekDayDate = firstDay
    End If
    MessageBox.Show(firstWeekDayDate.ToLongDateString)
1 Like

Sorry but I didn’t understand how I should use IF for this condition.

Good evening Lucas,

Does this UiPath Go component resolve your issue?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.