How can I Get the dates of current week

I wanted to get the dates of current week in a variable, How can i get it in below format.
Like current week starts from Monday as (Jul 18,2023) and Sunday as (Jul 25,2023).

Hi,

I think this week’s Monday is 19. Anyway, the following expression will work. Can you try this?

days = Enumerable.Range(1,7).Select(Function(i) Now.AddDays(-1*CInt(Now.DayOfWeek)+i).ToString("MMM d, yyyy")).ToArray

note: days is string array type

Regards,

How i Use this array to find that the current day is available in that array of string? using if condition or loop?

Hi,

We can check it using Contains method as the following.

days.Contains(Now.ToString("MMM d, yyyy"))

image

Regards,

GetthedateoftheMondayofthecurrentweek1.xaml (10.3 KB)
Please find the xaml file, I hope It will meet your requirement.

I have a data table in which all the extracted dates are saved and I wanted to compare these array string with data table dates that if that array string date is available in data table or not.

Data table dates :
image

Comparison with current week dates.

Hi,

Can you try as the following?

arrDate =Enumerable.Range(1,7).Select(Function(i) Now.AddDays(-1*CInt(Now.DayOfWeek)+i).ToString("MMM d, yyyy")).ToArray

Then

arrDate = arrDate.Intersect(dt.AsEnumerable.Select(Function(r) r("ColumnName").ToString)).ToArray

Regards,