How do I convert an INT into HH:mm:ss using SSRS 2005

放肆的年华 提交于 2020-01-13 13:09:54

问题


Ok I need to display total talk time of an agent that is coming into SRSS 2005 from SQL 2005 as an INT.

For the life of me I cannot figure out what combination of expression editing or format editing I need to use.

For the detail portion I can use: =DATEADD("s", SUM(Fields!Talk_Time.Value), CDate("00:00"))

And it will return: 1/1/0001 12:00:14 AM

Now I can use =LEFT(DATEADD("s", SUM(Fields!Talk_Time.Value), CDate("00:00")),8)

Which will return: 12:00:14

But really what I need is: 00:00:14

Please help!


回答1:


Basically you are getting back 12 hour time as in 12 AM or in "hh" format, you want 24 hour time or "HH" format.

You can use the ToString() function to help you format it the way you want it...I'll put in 14 seconds in place of your SUM(Fields!Talk_Time.Value)

=DATEADD("s", 14, CDate("00:00")).ToString("HH:mm:ss")

Returns...00:00:14

Or say it's more like 3 hours (10,800 sec)...

=DATEADD("s", 10800, CDate("00:00")).ToString("HH:mm:ss")

Returns...03:00:00

That will do the trick with no LEFT or RIGHT needed.

=DATEADD("s", SUM(Fields!Talk_Time.Value), CDate("00:00")).ToString("HH:mm:ss")


来源:https://stackoverflow.com/questions/2481351/how-do-i-convert-an-int-into-hhmmss-using-ssrs-2005

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!