DateTime date1 = DateTime.Now;
DateTime date2 = new DateTime(2015, 4, 30, 0, 0, 0); //2015-04-30 00:00:00
TimeSpan ts = new TimeSpan();
ts = date1 - date2;
Response.Write(ts.Days + "天" + ts.Hours + "小时" + ts.Minutes + "分" + ts.Seconds + "秒");
NET计算时间差(天、小时、分钟、秒)
最新推荐文章于 2019-10-26 08:58:43 发布