直接上代码。
using System.Globalization; /// <summary> /// 获取某一日期是该年中的第几周 /// </summary> /// <param name="dt">日期</param> /// <returns>该日期在该年中的周数</returns> private int GetWeekOfYear(DateTime dt) { //by www.jb200.com GregorianCalendar gc = new GregorianCalendar(); return gc.GetWeekOfYear(dt, CalendarWeekRule.FirstDay, DayOfWeek.Monday); }