getWeekOfYear to take week numbers of last month

Hi Advanced Devs,

I’ve got some troubles getting into this:

Im need to calculate the numbers of the weeks of the past month. If I’m in April, I need to know the number of every week of March. Is not just one week, I need all of the numbers.

Ej. If the month is January, the weeks of year will be 1 , 2 , 3 and 4. (If january has four weeks) And february numbers will be 5, 6, 7 and 8.

Let me know if you know how to solve this problem.


Please find the attached workflow to find the week no. of the year.

WeekNumber.xaml (6.5 KB)

Hi @lakshman thank you, I’ve had it already. The problem is that I need to GetWeekOfYear of every week of last month. I don’t know where to start to generate the resutls. :open_mouth:

Hi @KevinDS,

I would suggest build on @lakshman idea to just get the first and the last day of the last month
new DateTime(dateNow.Year, DateNow.AddMonths(-1).Month,1)

Then get for both of the the GetWeekOfYear then you will have the start and end weeks for your interval and can build a little array with this information.

Hi, Ive Created another way to build it.

  • I’ve change the value of dt to: DateTime.Now.AddMonths(-1).AddDays(-now.Day+1)
  • Then I’ve create a do while activity with a write line into it showing the weekofYear
  • Into the do while i’ve also put an assign increasing the value of dt with ‘dt.addDays(7)’
  • the condition of this while is to catch the weeks numbers while is already the last month

Thank you everyone for your support
Greetings and Best Regards

1 Like