Week Number Problem

Hello !

I want to get the current week number and I have the following code:

CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstDay,DayOfWeek.Monday)

The problem is that it shows that the current week number is 23, but it should be 22.

How can I fix this with proper code ?

Many thanks!

Hi ,

Please Try This ,

cint(System.Globalization.CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(now, CalendarWeekRule.FirstFullWeek,System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek))

2 Likes