//计算某年某周的周几的日期
//参数dweek取值是1-53,表示第几周
//参数dweekday取值是1-7,表示周一到周日
private DateTime DateOfWeek(int dyear, int dweek, int dweekday)
{
string firstdayofyear = dyear.ToString() + "-01-01";
DateTime firstday = Convert.ToDateTime(firstdayofyear);
int weekday = (int)firstday.DayOfWeek;
if (weekday == 0) weekday = 7;
DateTime dt = firstday.AddDays((dweek - 2) * 7 + weekday + dweekday - 1);
return dt;
}
//参数dweek取值是1-53,表示第几周
//参数dweekday取值是1-7,表示周一到周日
private DateTime DateOfWeek(int dyear, int dweek, int dweekday)
{
string firstdayofyear = dyear.ToString() + "-01-01";
DateTime firstday = Convert.ToDateTime(firstdayofyear);
int weekday = (int)firstday.DayOfWeek;
if (weekday == 0) weekday = 7;
DateTime dt = firstday.AddDays((dweek - 2) * 7 + weekday + dweekday - 1);
return dt;
}