C# 获取输入日期为一年中的第几周

 1 /// 
 2 /// 获取指定日期,在为一年中为第几周
 3 /// 
 4 /// 指定时间
 5 /// 返回第几周
 6 private static int GetWeekOfYear(DateTime dtWeek)
 7 {
 8   System.Globalization.GregorianCalendar gc = new System.Globalization.GregorianCalendar();
 9   int weekOfYear = gc.GetWeekOfYear(dtWeek,System.Globalization.CalendarWeekRule.FirstDay, DayOfWeek.Monday);
10   return weekOfYear;
11 }

 

你可能感兴趣的:(C# 获取输入日期为一年中的第几周)