Question

I'm using SSRS 2005 and I need to convert time from a serial unix time like 3412.254263 to a duration like 166:12:35 where the second format is HH:MM:SS.

All .NET code should work, but I can't find any function that does not include the date or does not treat the result as a duration.

Any help would be appreciated!

Was it helpful?

Solution

Public Shared Function formatSeconds(ByVal seconds As Double) As String
    Dim ts As TimeSpan = TimeSpan.FromSeconds(seconds)
    Return String.Format("{0:00}:{1:00}:{2:00}", Math.Floor(ts.TotalHours), ts.Minutes, ts.Seconds)
End Function

EDIT: I placed it in a function, with VB.NET syntax.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top