protected void Button1_Click(object sender, EventArgs e)
{//日期时间差
//DateTime time1 = new DateTime(1982, 4, 24, 14, 23, 06);//此方式不够好用
//DateTime time2 = new DateTime(1982, 6, 21, 8, 16, 32);//此方式不够好用
//TimeSpan ts = time2.Subtract(time1);
DateTime dt1 = Convert.ToDateTime("2007-3-24 11:29:12");
DateTime dt2 = Convert.ToDateTime("2007-2-24 10:29:12");
TimeSpan ts = dt1 - dt2;
string timespan = "相差:"
+ ts.Days.ToString() + "天"
+ ts.Hours.ToString() + "小时"
+ ts.Minutes.ToString() + "分钟"
+ ts.Seconds.ToString() + "秒";
Label1.Text = timespan;
}