方法一:
using System.Globalization;
TaiwanCalendar tc=new TaiwanCalendar();
int Now_num=tc.GetWeekOfYear(DateTime.Now,CalendarWeekRule.FirstFullWeek,DayOfWeek.Sunday);
//获取当前日期是本年的第几周
方法二:
Code
private int GetWeekOrderOfDate(DateTime Date)
{
//当天所在的年份
int year = Date.Year;
//当年的第一天
DateTime firstDay = new DateTime(year, 1, 1);
//当年的第一天是星期几
int firstOfWeek = Convert.ToInt32(firstDay.DayOfWeek);
//当年第一周的天数
int firstWeekDayNum = 7 - firstOfWeek;
//传入日期在当年的天数与第一周天数的差
int otherDays = Date.DayOfYear - firstWeekDayNum;
//传入日期不在第一周内
if (otherDays > 0)
{
int weekNumOfOtherDays;
if (otherDays % 7 == 0)
{
weekNumOfOtherDays = otherDays / 7;
}
else
{
weekNumOfOtherDays = otherDays / 7 + 1;
}
return weekNumOfOtherDays + 1;
}
//传入日期在第一周内
else
{
return 1;
}
}