Bot runs thursday now how to find

bot runs every Thursday how to find if its last Thursday or not

Get last Thursday by using the below code inside an Assign:

DateTime lastThursday = DateTime.Now.AddDays(-1);
while(lastThursday.DayOfWeek != DayOfWeek.Thursday){
    lastThursday = lastThursday.AddDays(-1);

what we need to do for sunday

Use the same logic and check for a Sunday.

Cheers @manoj2500 :slight_smile:

so i just need to replace thursday by sunday right

Yes, try it and let me know if you are facing any issues.

@monsieurrahul can you please help me with sunday xaml i am getting error

Okay, what is your requirement? You want to fetch previous Sunday’s date?

actually bot will run everyday if its last sunday of the month then it will send an email

eg. if bit is running today then it will checkif its not the last sunday of current month

if its sunday and last sunday then it will send an email if its not it wont do anything


To achieve that, you simply need to use the below expression inside an if condition:

DateTime.Today.DayOfWeek.ToString = "Sunday"

can you plaese help me in this plzz Test.xaml (5.6 KB)