DateTime dt1 = DateTime.Now; DateTime dt2 = DateTime.Now.AddDays(-7); TimeSpan ts = dt1 - dt2; int days = ts.Days; //dt1和dt2相差多少天