Date PreviousMonths FirstDayofWeek and LastDayOfWeek


#1

How to we get the Previous Months Current Weeks, FirstDayOftheWeek and LastDayOftheWeek
it should take today current date, minus the month and calculate the first and last day of the week,

Example,
If the Bot is Running on as Current Date like July 6 2017, so we want to get the result
FirstDayOfTheWeek as June 4 2017
LastDayOfTheWeek as June 10 2017

If the Bot is Running on as CurrentDate like July 18 2017, we should get the result as
FirstDayOfTheWeek as June 18 2017
LastDayOfTheWeek as June 24 2017

If the Bot is Running on as CurrentDate like July 29 2017, we should get the result as
FirstDayOfTheWeek as June 25 2017
LastDayOfTheWeek as July 1 2017


#2

You can get previous month’s date by
Today.AddMonths(-1)

And you can calculate specific date by AddDays method.

For example, if you assume the week starts from Sunday then the FirstDayOfTheWeek must be
Today.AddMonths(-1).AddDays(- (Weekday(Today) - 1))