I want to ask, when it is Monday(ddMMyy) it will read Saturday’s date. but when Tuesday, Wednesday, Thursday, Friday, read the date on the same day. What are the appropriate variable contents for the above conditions? Thank You. Please help
Answered:
If Now.DayOfWeek = DayOfWeek.Monday Then
variable_contents = (Now.AddDays(-2)).ToString(“ddMMyy”)
Else
variable_contents = Now.ToString(“ddMMyy”)
End If
Hi @wsinten
Please try this
currentDate = DateTime.Now.Date
If currentDate.DayOfWeek = DayOfWeek.Monday
Then
targetDate = currentDate.AddDays(-2)
Else
targetDate = currentDate
I hope it helps!!
Hi @wsinten
currentDate = DateTime.Now.Date
If currentDate.DayOfWeek = DayOfWeek.Monday
Then
targetDate = currentDate.AddDays(-2)
Else
targetDate = currentDate
Note: Datatype of currentDate and targetDate is System.DateTime.
Refer the workflow for more reference:
Sequence17.xaml (9.9 KB)
Hope it helps!!