Can anyone help me on below query
I need to get previous week Sunday date and Saturday date, so for example the dates will be 24th May 2020 i.e Sunday and 30th May 2020 Saturday.
I am working with UI path studio X.
So what logic i need to apply to get the output
So you need two days corresponding to a week, starting on Sunday and ending on Saturday.
The steps you need to take are the following:
- Create two System.DateTime variables, lastSaturday and lastSunday
- Assign to lastSunday the value Datetime.Now
- Create a while loop. Condition: lastSunday.DayOfWeek <> DayOfWeek.Sunday
- Inside the loop, assign to lastSunday the value Sunday.AddDays(-1)
Since you need the last week’s Sunday:
- After the loop, assign to lastSunday the value lastSunday.AddDays(-7)
- Do the steps 2-4 for lastSaturday. Ignore step no 5 since you don’t need last weeks Saturday.
Now, you should have the two DateTime variable stored.