Create a Variable = Current ISO Week

Hi I’m trying to create a variable that can return the ISO Week number of the Current Date

I thought using the following formula would work
ISOWeek.GetWeekOfYear(DateTime.Now)

But I get an error message "ISOWeek is not delared…
I also tried just GetWeekOfYear(DateTime.Now), but I get the same message.

Is there a simple way of achieving this?

@CRETE_Thierry
ISOWeek.GetWeekOfYear is available for .net5 but not within the infrastructure that we do use with UiPath
for getting the week number have a look here:

reference:

some parameters in action:

1 Like

So are you saying “THERE IS NO SOLUTION”
or your telling me:
ISOWeek.GetWeekOfYear does not work in UiPath
BUT… Calendar.GetWeekOfYear… will work ?

Was never and nowhere mentioned. And with a provided alternate its feasability was shown.

ISOWeek.GetWeekOfYear - not available in .Net framework 4.6.1
Calendar.GetWeekOfYear - we get it work

on how to do you can refer on provided links

grafik

1 Like

Thanks for the clarification.
So I changes my formula in my variable to the following:
Calendar.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstDay, DayOfWeek.Monday)

I still get the same “is not delared” error message.

What Am I doing wrong?
I’ve also tried adding the CultureInfo… prefix
Also tried changing DateTime.Now to Date.Now.

I thought this part of my automation was going to be so simple!! :frowning: