Get Week of the Month


#1

Hi,

Im trying to get week of the month.
For example:
30 July - 5 August, result is 1st week of August.
6 august - 12 august , result is 2nd week of august.
the week will be counted from Monday to sunday.
Any way can do so?


#2

Look here


you can reproduce similar logic in UiPath.


#3

@yjunkang
// variable type of in_Today DateTime (this will be your input datetime)
// variable type of Basedate is DateTime
// variable type of week is Int64

Assign Basedate = new DateTime(in_Today.Year, in_Today.Month, 1)
Assign week = DateAndTime.DateDiff(DateInterval.WeekOfYear ,Basedate, in_Today, FirstDayOfWeek.Monday,FirstWeekOfYear.Jan1)
actual value = week+1