Be aware that this does not return ISO 8601 week numbers.
System.Globalization.CultureInfo myCI = System.Threading.Thread.CurrentThread.CurrentCulture; int weekNo = myCI.Calendar.GetWeekOfYear(new DateTime(2008,12,31),
myCI.DateTimeFormat.CalendarWeekRule,
myCI.DateTimeFormat.FirstDayOfWeek);
In Sweden we use ISO 8601 week numbers but even though the culture is set to "sv-SE", CalendarWeekRule is FirstFourDayWeek, and FirstDayOfWeek is Monday the weekNo will be set to 53 instead of the correct 1 with the above code.
I have only tried this with Swedish settings but my guess is that all countries (Austria, Germany, Switzerland and more) using ISO 8601 week numbers will be affected by this problem.