Find number of weeks in previous month

Hi Can anyone please tell how to find the number of weeks in previous month and also to filter the datatable contents for previous month

@ash864u Welcome to Our UiPath Communtity.

Use following code in Invoke Code activity:
Sequence28.xaml (4.6 KB) Sequence10.xaml (7.2 KB)
Dim today As DateTime, daysInMonth As Int32, firstDayOfMonth As Int32, firstOfMonth As DateTime today = DateTime.Now.AddMonths(-1) daysInMonth = DateTime.DaysInMonth(today.Year, today.Month) firstOfMonth = New DateTime(today.Year, today.Month, 1) firstDayOfMonth = CInt(firstOfMonth.DayOfWeek) weeksInMonth = CInt(Math.Ceiling((firstDayOfMonth + daysInMonth) / 7.0))