List Current Week Dates

Dears,

Could you please help to list the dates of current week ?

Hi Again,

Or using another way: Find FirstDayofWeek and LastDayOfWeek than list the contained dates inside this interval. Thx

I was going to write out a quick idea of how to do it, but a quick google search and copy+paste seemed quicker. Here’s how you can quickly find the first and last day of the week https://stackoverflow.com/questions/37912201/how-do-i-get-the-start-date-and-end-date-of-the-current-week

Then you could use a loop to add each date between start date and end date to a list.

2 Likes

Thanks Dave, But my concern is to get all 7 days between 1st and Last Day of week.
Example : Today is 07/02/2019, So:
FirstDayOfWeek is : 07/01/2019
LastDayOfWeek is : 07/07/2019

At the End I need all Dates between those 2 Days :
07/01/2019
07/02/2019
07/03/2019
07/04/2019
07/05/2019
07/06/2019
07/07/2019

Thanks in Advance

Hi Again,

I find the solution in the following topic : How to get the dates in between two dates

Here’s a quick loop off the top of my head. Might not be the most efficient but this is so small it shouldnt matter

I’ll assume you have a List variable called DatesInWeek
Use a for each activity and change the type to integer:
For each day in Enumerable.Range(0,6) <integer> - 'this is the same as a for loop from 0 to 6
Use the add to collection activity: DatesInWeek = StartDate.AddDays(day)

And that’s it! I guess all you really need is the startdate if you know it’s always exactly 7 days you need. You could make this function more re-useable if you want by passing in start date + end date, then finding the amount of days in between those dates, then subbing out the 6 in Enumerable.Range(0,6) with the amount of days

1 Like

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