Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Function 使用函数将SSRS中的秒转换为HH:MM:SS_Function_Reporting Services_Time_Ssrs 2012_Date Conversion - Fatal编程技术网

Function 使用函数将SSRS中的秒转换为HH:MM:SS

Function 使用函数将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

我在下面有一个函数,用于在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 = 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。现在很好用