How to find last 2 previous week monday dates i.e march 09 and 02

Hi Team,

I want to know how to find the last two week monday dates if i run the bot from the current week.

For e.g if i run the bot now, previous week monday date is march 09 and another previous week date is march 02, i want to retrieve these 2 dates. please help.

Thanks,
Ula

dtToday = DateTime.Now
numDay = (int)dtToday.DayOfWeek

If (numDay = 0)
   PrvMonday = dtToday.AddDays(-6)
   PrvPrvMonday = dtToday.AddDays(-13)
Else
   PrvMonday = dtToday.AddDays(-(numDay+6))
   PrvPrvMonday = dtToday.AddDays(-(numDay+13))

Here 0 is considered as new week starts with Sunday.

Regards,
Karthik Byggari

1 Like

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