问题
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