private void button1_Click(object sender, EventArgs e) { string dateDiff = ""; DateTime time2 =Convert.ToDateTime( "2014-01-15 00:00:00.000"); TimeSpan ts1 = new TimeSpan(DateTime.Now.Ticks); TimeSpan ts2 = new TimeSpan(time2.Ticks); TimeSpan ts = ts1.Subtract(ts2).Duration(); dateDiff = ts.Days.ToString(); MessageBox.Show("日期之差是"+dateDiff); }