static DateTime FirstMonday(int year)
{
DateTime day = DateTime.Parse(year.ToString()+"-1-1");
while (day.DayOfWeek != DayOfWeek.Monday)
{
day = day.AddDays(1);
}
return day;
}
static void Main(string[] args)
{
for (int year = 1990; year < 2010; year++)
{
Console.WriteLine(FirstMonday(year).ToString("yyyy-MM-dd"));
}
Console.ReadLine();
}
同意楼上.哈.但是.好像有这个函数可以得到啊。
DateTime day = DateTime.Parse(year.ToString()+"-1-1");
=>
DateTime day = new DateTime(year, 1, 1);