blog.pagesd.info // Archives // Traductions

Retrouver un numéro de semaine

2005-11-04 #code-snippets,#c-sharp

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