/// <summary>
/// 返回一个数组长度为3的字符串数组
/// </summary>
/// <returns>GetWeekDay[0]=周次;GetWeekDay[1]=该周第一天;GetWeekDay[2]=该周最后一天</returns>
public string[] GetWeekDay()
{
string[] inti = new string[3];
DateTime day = DateTime.Parse(DateTime.Today.Year + "-1-1");
System.DayOfWeek dateTime = day.DayOfWeek;
int DayCount = DateTime.Today.DayOfYear;
int i = (DayCount + aa(dateTime) - 2) / 7 + 1;
inti[0] = i.ToString();
inti[1] = day.AddDays(DayCount - 1).ToString("yyyy年MM月dd日");
inti[2] = day.AddDays(DayCount + 5).ToString("yyyy年MM月dd日");
Response.Write("第"+i+"周");
return inti;
}
private int aa(System.DayOfWeek weekday)
{
switch (weekday.ToString())
{
case "Sunday":
return 1;
case "Monday":
return 2;
case "Tuesday":
return 3;
case "Wednesday":
return 4;
case "Thursday":
return 5;
case "Friday":
return 6;
case "Saturday":
return 0;
default:
return 8;
}
}