Sum Time (HH:MM) in RDLC

。_饼干妹妹 提交于 2020-01-15 12:29:07

问题


I have and RDLC report an I need to get the sum of the fild "Time". I save it in the database with varchar type with the format "hh:mm".

I get this with the formula:

=(Sum(System.TimeSpan.Parse(Fields!HorasEfectivas.Value).Hours))
&":"&
Sum(System.TimeSpan.Parse(Fields!HorasEfectivas.Value).Minutes))

The problem here is the sum of the minutes. 140 minutes shoul be transformed in hours! How can I get this? Regards


回答1:


try using TimeSpan e.g.

      var time1 = new TimeSpan(0,2,02,0);
      var time2 = new TimeSpan(0, 5, 02, 0);

      var totalHours = time1 + time2;


来源:https://stackoverflow.com/questions/26740728/sum-time-hhmm-in-rdlc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!