在dateTime对象上添加年份:
DateTime baseDate = new DateTime(2000, 2, 29); Console.WriteLine("Base Date: {0:d}\n", baseDate); // 显示前十五年的日期。 for (int ctr = -1; ctr >= -15; ctr--) Console.WriteLine("{0,2} year(s) ago:{1:d}", Math.Abs(ctr), baseDate.AddYears(ctr)); Console.WriteLine(); // 显示未来十五年的日期。 for (int ctr = 1; ctr <= 15; ctr++) Console.WriteLine("{0,2} year(s) from now: {1:d}", ctr, baseDate.AddYears(ctr));