1.
DateTime t1 = Convert.ToDateTime("1999-8-9");
DateTime t2 = Convert.ToDateTime("2007-8-19");
TimeSpan ts = t2 - t1;
int d = ts.Days;
d就是间隔的天数
2.
TimeSpan ts=System.DateTime.Now - Convert.ToDateTime("2004-09-01");
int days= ts.TotalDays;
事件相减,结果是一个TimeSpan类
3.
DateTime TwoDate = Convert.ToDateTime(textBox1.Text);
TimeSpan ts = DateTime.Now.Subtract(TwoDate);
int days = ts.Days;
textBox2.Text = ts.ToString();