I have a requirement to access the file which has the date in filename. That file generates every week on Monday. So, when my bot is running any day of the week, I should train my bot to access the latest Monday date file. Can anyone help with how to get the latest Monday date into variable?
we had configured an Array with the offset of days we want to get back to the week’s monday
with the DayOfWeek (0=Sunday, 1=Monday,6=Sunday) we select the offset as needed
When we do have other rules e.g. on Monday get Monday of previous week … then we just modify the array with the offsets
with AddDays( - CalculatedOffset) we retrieve the Monday of the Week of myDate
@divya.x.kuchi
Hello, there are many ways to do this, but one is to:
Assign activity: CurrentDate = DateTime.Now
Assign activity: Day = DateTime.Now.DayOfWeek.ToString
Else If activity (you will need 6 of these): Condition: Day = “Monday”
Assign activity: GetMonday = CurrentDate
Tuesday will be -2
Wednesday will be -3…so on
Final Else will be: Assign activity: GetMonday = CurrentDate.AddDays(-6)
CurrentDate is DateTime type
Day is String type
GetMonday is DateTime type