How to Enter Last week Date From : Monday and Date to : Sunday, if we run any day of the current week

I have user Interface with : Date From and Date To:
I need to Enter last Week Date, Starting From Monday to Sunday.
If I run on Current Week Monday, it should take Last week Monday to Sunday.
Even, if i run on Current Week Tuesday, Wednesday…
Still it Needs to Enter from Last Week Monday and Sunday.
How to achieve this please ??


Can you try the following expressions?

toDate = Enumerable.Range(1,7).Select(Function(i) Today.AddDays(-1*i)).Where(Function(d) d.DayOfWeek = DayOfWeek.Sunday).First

fromDate = toDate.AddDays(-6)


thank you.

1 Like

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