Retrouver un numéro de semaine

2005-11-04 #code-snippets#csharp

public static int GetWeekNumber (DateTime dt) {
  CultureInfo culture = CultureInfo.CurrentCulture;
  int intWeek = culture.Calendar.GetWeekOfYear(dt, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
  return intWeek;
}