Weekdays of the previous month

I want to know the number of weekdays every week of the previous month.
For example, it’s January now, so the first week of 2023/December: Week 1, 2: 5, 3: 5, 4: 5, 5 like this,
If you look at 2024/January, week one: five, week two: five, week three: five, week four: three. I want to find this: five, five, five, three

Hi,

How about the following sample?

arrResult = String.Join("",Enumerable.Range(1,DateTime.DaysInMonth(targetYear,targetMonth)).Select(Function(i) CInt(New DateTime(targetYear,targetMonth,i).DayOfWeek))).Split("06".ToCharArray,StringSplitOptions.RemoveEmptyEntries).Select(Function(s) s.Length).ToArray

Sample
Sample20240111-1.zip (2.6 KB)

Regards,

2 Likes

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