Wrong week number


I’m trying to get the correct weeknumber of the current week.
Unfortunately, with the following command, it always adds 1 to the result :
CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(Date.Now, CultureInfo.InvariantCulture.DateTimeFormat.CalendarWeekRule,CultureInfo.InvariantCulture.DateTimeFormat.FirstDayOfWeek)

It seems related to the ISO 8601.
When I put CultureInfo.InvariantCulture.DateTimeFormat.CalendarWeekRule into a MessageBox I get “FirstDay
And from what I understood, it should be “FirstFourDayWeek” to work correctly.

So… I’m wondering what’s wrong… :frowning:
Because on one hand I could not find a solution with UiPath, and on the other hand weeknumber is used by a lot of people.

Has anyone found a solution to get the correct weeknumber for 2021 ?
Or maybe a way to change the CalendarWeekRule to “FirstFourDayWeek” ?


PS : Hope I’m at the correct place/with the correct tags… ?

Welcome to the forum

have a look here:

Thanks Peter!
I mixed up CultureInfo.InvariantCulture.DateTimeFormat.CalendarWeekRule
and System.Globalization.CalendarWeekRule.FirstFourDayWeek :frowning:

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