while (true)
{
Console.Write("输入日期:");
string s = Console.ReadLine();
try
{
DateTime d = Convert.ToDateTime(s);
p0 = new DateTime(d.Year, 3, 1);
p0 = p0.AddDays((12 - (int)p0.DayOfWeek) % 7);
p0 = d >= p0 ? p0 : p0.AddDays(-52 * 7);
}
catch (Exception)
{
Console.WriteLine("** 输入错误 **");
continue;
}
for (int m = 1; m <= 12; m++)
{
string fmt = "P{0}, {1:yyyy-MM-dd}, {2:yyyy-MM-dd}";
Console.WriteLine(string.Format(fmt, m, p(m), p(m + 1).AddDays(-1)));
}
}
}