Function 使用函数将SSRS中的秒转换为HH:MM:SS
我在下面有一个函数,用于在SSRS中将秒转换为HH:MM:SS。这需要工作超过86400秒,即总时间可能超过24小时。下面的函数现在返回奇怪的值,如00:00:.2或00:00:75Function 使用函数将SSRS中的秒转换为HH:MM:SS,function,reporting-services,time,ssrs-2012,date-conversion,Function,Reporting Services,Time,Ssrs 2012,Date Conversion,我在下面有一个函数,用于在SSRS中将秒转换为HH:MM:SS。这需要工作超过86400秒,即总时间可能超过24小时。下面的函数现在返回奇怪的值,如00:00:.2或00:00:75 Public Function ConvertSecondsToHourMinSec(ByVal intTotalSeconds) As String Dim hours As String =INT(intTotalSeconds/3600) If Len(hours) < 2 Then hours
Public Function ConvertSecondsToHourMinSec(ByVal intTotalSeconds) As String
Dim hours As String =INT(intTotalSeconds/3600)
If Len(hours) < 2 Then
hours = RIGHT(("0" & hours), 2)
End If
Dim mins As String = RIGHT("0" & INT((intTotalSeconds MOD 3600)/60), 2)
Dim secs AS String = RIGHT("0" & ((intTotalSeconds MOD 3600) MOD 60), 2)
ConvertSecondsToHourMinSec = hours & ":" & mins & ":" & secs
End Function
例如,将227.16666的值传递给此函数,得到00:03:67
知道我如何修复这个函数来正确地给出HH:MM:SS吗?意识到我没有在底部将秒转换为INT。现在很好用