[求助]两datetime型相减如何取出相差的日期数
我想this.outtime.Value - this.intime.Value取出相差的日期数放在 textbox1中,如何写?
this.outtime.Value = Convert.ToDateTime("2007-10-20 19:00:00");
this.intime.Value = Convert.ToDateTime("2007-10-18 18:00:00");
TimeSpan c = this.outtime.Value-this.intime.Value;
MessageBox.Show(Convert.ToInt32(c.Days).ToString());
返回是1天,不是我想要的 2007-10-20 - 2007-10-18 = 2 天