Search code examples
reporting-servicesssrs-2008

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


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!


Solution

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