日期:2014-05-20  浏览次数:20858 次

C# 时间间隔计算
    比如:2个时间间隔是2个小时。   
那么我需要这2个小时显示为120分钟。
如果是2.5小时。  那么我获得的时间间隔就是150分钟
------解决方案--------------------
乘以60不就好了
------解决方案--------------------

DateTime time1 = DateTime.Parse("2012-09-01 12:13:13");
DateTime time2 = DateTime.Parse("2012-09-01 14:33:13");
TimeSpan ts= time2 - time1;
Response.Write(ts.TotalMinutes);

输出:140分钟