日期:2014-05-18 浏览次数:21819 次
DateTime dt1 = DateTime.Now; DateTime dt2 = DateTime.Now.AddHours(-3).AddDays(-1); TimeSpan ts = dt1.Subtract(dt2); double hours = ts.TotalHours;//27.0
------解决方案--------------------
DateTime a = DateTime.Now; DateTime b = a.AddHours(5); int c =(b - a).Hours;