DateDiff结果在SSRS中设置为HH:MM:SS

时间:2014-06-10 10:09:12

标签: reporting-services

我希望从DateDiff返回的值格式化为HH:MM:SS.

目前,我正在使用:

=DateDiff("S",Fields!StartDate.Value,Fields!EndDate.Value).

如何修改上述表达式?

2 个答案:

答案 0 :(得分:0)

=RIGHT("0" + CStr(DateDiff("S",Fields!StartDate.Value,Fields!EndDate.Value)/3600), 2) + ":" +
 RIGHT("0" + CStr((DateDiff("S",Fields!StartDate.Value,Fields!EndDate.Value)/60) Mod 60), 2) + ":" +
 RIGHT("0" + CStr(DateDiff("S",Fields!StartDate.Value,Fields!EndDate.Value) Mod 60), 2)

答案 1 :(得分:0)

修复:

=DATEDIFF("h",Fields!StartDate.Value,Fields!EndDate.Value) 
 & ":" & DATEDIFF("n",Fields!StartDate.Value,Fields!EndDate.Value) MOD 60 
 & ":" & DATEDIFF("s",Fields!StartDate.Value,Fields!EndDate.Value) MOD 60