Hi everyone,
I have a use case where a due date will be the 2nd Wednesday of the next month of given month and year.
Discussion posts and replies are publicly visible
Here's a method which goes to the first day of the month after now() and calculates the offset to the first Wednesday then just adds 7 days to get to the second Wednesday. The local!now variable was just to easily test. Code can easily be adjusted if the input isn't just a date and time (ie. If you needed to specify a month and year).
a!localVariables( local!now: a!addDateTime(startDateTime: now(), months: 0), local!firstDayOfNextMonth: eomonth(local!now,0) + 1, local!dayValueOfFirstDayInMonth: weekday(local!firstDayOfNextMonth), local!firstWednesdayOfMonthOffset: mod(7 - local!dayValueOfFirstDayOfMonth + 4, 7), local!firstWednesdayOfMonth: local!firstDayOfNextMonth + local!firstWednesdayOfMonthOffset, local!secondWednesdayOfMonth: local!firstWednesdayOfMonth + 7, local!secondWednesdayOfMonth )