如何在小时内显示时间超过24小时的SSRS
我有一份报告,列显示了24小时累积时间超过的时间。我希望在几个小时内展示它。 我找到了一个解决方案,当时间超过86400秒(一天中的秒数)时,它将显示几天和时间的数量,但我只想在小时内显示时间。
=IIF(Fields!TotalTime.Value < 86400,
Format(DateAdd("s", Fields!TotalTime.Value, "00:00:00"), "HH:mm:ss"),
Floor(Fields!TotalTime.Value / 86400) & " days, " & Format(DateAdd("s", Fields!TotalTime.Value,
"00:00:00"), "HH:mm:ss")
I have a report with a column displaying time cumulatively overshooting 24 hours. I'd like it to be displayed in hours.
I've found a solution that when time exceeds 86400 seconds (number of seconds in a day), it'll display number of days and time but I want only time in hours to be displayed.
=IIF(Fields!TotalTime.Value < 86400,
Format(DateAdd("s", Fields!TotalTime.Value, "00:00:00"), "HH:mm:ss"),
Floor(Fields!TotalTime.Value / 86400) & " days, " & Format(DateAdd("s", Fields!TotalTime.Value,
"00:00:00"), "HH:mm:ss")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您只能使用表达式执行此操作,但这种方式可以重复使用一点。.
将以下代码添加到您的报告的自定义代码
向原始作者致歉。
( “ rel =“ nofollow noreferrer”>
此功能将花费几秒钟并转换到HH:MM:SS格式。
现在,我们要做的就是通过每行的累积秒数。
我们可以使用system.timespan为此。
这假设数据库字段是时间数据类型
从中间开始锻炼。...
timeinoffice
字段的值,并且由于它是> Time
数据类型我们可以使用tatalseconds
属性来获取这次代表的秒数。nothere 关键字)
结果看起来像这样。
You could do this with expressions only but this way is a little bit more reusable..
Add the following code to your Report's custom code
(apologies to the original author who's blog I based this on years ago... I can't find your post)
This function will take a number of seconds and convert to to HH:MM:SS format.
Now all we have to do is pass in the cumulative number of seconds for each row.
We can use System.TimeSpan for this.
This assumes the database field is a TIME datatype
Starting from the middle and working out....
TimeInOffice
field and, as it's aTime
datatype we can use theTotalSeconds
property to get the number of seconds this time represents.Nothing
keyword)The result looks like this.