Hi,
How can I get previous Wednesday date based on today. If today is 04/12/24, then last Wednesday is 04/10/24
Hi @niro
daysToSubtract = If(DateTime.Today.DayOfWeek >= DayOfWeek.Wednesday, (DateTime.Today.DayOfWeek - DayOfWeek.Wednesday), (7 - CInt(DayOfWeek.Wednesday) + CInt(DateTime.Today.DayOfWeek)))
daysToSubtract
is of DataType System.Int32.
lastWednesday = DateTime.Today.AddDays(-daysToSubtract)
lastWednesday
is of DataType System.String.
Hope it helps!!
Option avtivity:
Option Code
myPrevWednesday =
myDateAsDateTime.AddDays(-{4,5,6,0,1,2,3}(myDate.DayOfWeek))
1 Like
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.