How to get the date(dd) of every monday

Hi Team,

I want to get the date of every monday all the year. Could you please let me know how to get that?

E.g In february - all monday dates are 3, 10, 17, 24

Thanks,
Ula

1 Like

@Boopathi This is the one thing I can think of as of now.

Hi @Boopathi,

AllDatesInMonth(year, month).Where(i => i.DayOfWeek == DayOfWeek.Monday)

Following function will give you collection of dates that falls on Monday.

2 Likes

Didn’t know about that
Thanks, @Ragu9060

@MartianxSpace its a Linq query, this is similar to select queries.

If you need to learn more on Linq look into the below link.

https://www.tutorialsteacher.com/linq/linq-tutorials

2 Likes

@Ragu9060 Can we use that query as it is Directly in UiPath, by assigning it to a variable?

@supermanPunch please provide more details on your question.

@Ragu9060 The Linq Query you Suggested , how do i use it?

1 Like

@supermanPunch simply use a assign activity, pass your linq query to right side of assign activity. To the left create a variable, linq query returns a collection of data so create a variable with data type related to collection like arrays.

@Ragu9060 “AllDatesInMonth” is it a variable?

Its a function @MartianxSpace

@Ragu9060 I mean I know a bit of Linq Query :sweat_smile:, My Question was in the Query :
AllDatesInMonth(year, month).Where(i => i.DayOfWeek == DayOfWeek.Monday)

We can’t use => operator in terms of UiPath

@Ragu9060 I am not able to use this funtion

DateTime.DaysInMonth(year,month)

Try using this instead of AllDatesInMonth

1 Like

@Ragu9060 I got it now, I was confused for a bit :sweat_smile:

@Ragu9060 But Still not able to Use Where condition with it :sweat_smile:

Actually DaysInMonth will return a int which is the count of days in the month. Try to convert the count into collection then it will work.

@MartianxSpace Can you share the workflow you created ?

@supermanPunch Here is the XAML file
Main.xaml (6.7 KB)

@supermanPunch Need to add few things so it can work irrespective of any day. I am working on it.