通过下面代码很容易知道 DateTime d = DateTime.Now; Response.Write(d.DayOfYear.ToString());今天是在今年中的第几天,现在想反推回去,不知道有没有人做过
2009.10.21 号在今年是第294天,我现在想通过294推算出2009.10.21 怎么做?

解决方案 »

  1.   

    DateTime.Parse("2009-01-01").AddDays(293);
      

  2.   


            static void Main(string[] args)
            {
                DateTime dt = new DateTime(2009, 1, 1);
                DateTime dt1 = dt.AddDays(294-1);  //1月1号是第一天
                Console.WriteLine(dt1.ToString("d"));
                Console.ReadLine();
            }
      

  3.   

    加法不会?2009.1.1+294(293?)AddDays...