Calculate number of particular weekdays in the current month?

If I wanted to create a task for a Robot to calculate how many Tuesdays there are in the current month, how would I go about that? Is there a VB function that can utilize NowMonth and determine that there are, say, 4 Tuesdays or 5 Thursdays in the current month and save that number as a variable?

Assign → DaysInMonth = what?

Assign Activity
myDate = DateTime.Now

Assign Activity:
myDaysCount | Int32 =

Enumerable.Range(1, DateTime.DaysInMonth(myDate.Year, myDate.Month)).Where(Function (x) new DateTime(myDate.year, myDate.month, x).DayOfWeek.Equals(DayOfWeek.Tuesday)).Count
1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.