How to print list of monday in a year by using uipath

mports System

Public Module Module1

Public Sub Main()
    Dim year As Integer = 2023 ' Specify the year
    Dim dateValue As New DateTime(year, 1, 1) ' Start from the first day of the year

    ' Loop through all days of the year
    While dateValue.Year = year
        ' Check if the day is Monday
        If dateValue.DayOfWeek = DayOfWeek.Monday Then
            Console.WriteLine(dateValue.ToString("yyyy-MM-dd")) ' Print the date
        End If
        dateValue = dateValue.AddDays(1) ' Move to the next day
    End While

    Console.ReadLine() ' Wait for user input before closing the console window
End Sub

End Module

Hi @shaik-mohammad.gajali

mondaysList = Enumerable.Range(0, (New DateTime(year, 12, 31) - New DateTime(year, 1, 1)).Days + 1).Select(Function(i) New DateTime(year, 1, 1).AddDays(i)).Where(Function(d) d.DayOfWeek = DayOfWeek.Monday).ToList()

Hope it helps!!

@shaik-mohammad.gajali,

Here is sample code:

Output:

Workflow:
Get Mondays.xaml (8.8 KB)

Thanks,
Ashok :slight_smile: