Display Seconds Count in HH:MM:SS format in SSRS 2008

泄露秘密 提交于 2019-12-18 03:37:48

问题


I have a table with a column, TotalTime that is an Integer value in seconds.

In Visual Studio / SSRS 2008 I want to display it in HH:MM:SS format.

Thanks!


回答1:


Just use an expression that adds that number of seconds to a zero time value

=Format(DateAdd("s", Fields!TotalTime.Value, "00:00:00"), "HH:mm:ss")

If it is larger than 24 hours, then you can use the following formula that adds the days portion:

=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"))



回答2:


For HH:mm:ss format you can use this:

=Floor(Fields!TotalTime.Value / 3600) &":"& Format(DateAdd("s", Fields!TotalTime.Value, "00:00"), "mm:ss")

In this case, for example 90000sec will be displayed as: 25:00:00

For DD:HH:mm:ss format use this:

Floor(Fields!TotalTime.Value / 86400) &":"& Format(DateAdd("s", Fields!TotalTime.Value, "00:00:00"), "HH:mm:ss")

90000sec will be shown as: 1:01:00:00



来源:https://stackoverflow.com/questions/13481890/display-seconds-count-in-hhmmss-format-in-ssrs-2008

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