locked
Converting Milliseconds to HH:mm in SSRS2012 RRS feed

  • Question

  • I'm very green so please be patient with me but I have a column "duration" in milliseconds and need to convert the output to hh:mm format. this is in SSRS2012 can anyone help?
    • Moved by David Dye Wednesday, February 6, 2013 9:03 PM Poster has specified that the question has to do with SSRS expression and not T-SQL
    Wednesday, February 6, 2013 8:40 PM

Answers

  • Use Expression for your Text Box and use the following code snippet.

    =TimeSpan.FromMilliseconds(Fields!MyField.Value).ToString("hh':'mm");


    Thanks & Regards,
    Prasanna Vaitheswaran


    Please mark the post as 'Answer', if it addresses or resolves your query. Please click on 'Vote as Helpful', if it is helpful.

    • Proposed as answer by shriprasanna Thursday, February 7, 2013 2:16 PM
    • Marked as answer by Jstrack13 Thursday, February 7, 2013 2:46 PM
    Wednesday, February 6, 2013 9:23 PM
  • The Text box inside the tablix which is intended to display the data in hh:mm format.

    Thanks & Regards,
    Prasanna Vaitheswaran


    Please mark the post as 'Answer', if it addresses or resolves your query. Please click on 'Vote as Helpful', if it is helpful.

    • Marked as answer by Jstrack13 Thursday, February 7, 2013 2:46 PM
    Wednesday, February 6, 2013 10:12 PM

All replies


  • declare @time int

    set @Time = 5400000

    Select  CONVERT(TIME,DATEADD (ms, @Time, 0))


    Hope it Helps!!

    Wednesday, February 6, 2013 8:54 PM
  • This is actually within an existing report, in the text box properties, numbers tab, writing an expression.
    Wednesday, February 6, 2013 8:58 PM
  • Since you have specified that this requirement is for an SSRS expression and not specific to T-SQL I have moved the post in order to get a better directed response.


    David Dye My Blog

    Wednesday, February 6, 2013 9:05 PM
  • Use Expression for your Text Box and use the following code snippet.

    =TimeSpan.FromMilliseconds(Fields!MyField.Value).ToString("hh':'mm");


    Thanks & Regards,
    Prasanna Vaitheswaran


    Please mark the post as 'Answer', if it addresses or resolves your query. Please click on 'Vote as Helpful', if it is helpful.

    • Proposed as answer by shriprasanna Thursday, February 7, 2013 2:16 PM
    • Marked as answer by Jstrack13 Thursday, February 7, 2013 2:46 PM
    Wednesday, February 6, 2013 9:23 PM
  • Tell me should I use the text box properties window from the column header or the box below it?
    Wednesday, February 6, 2013 9:36 PM
  • The Text box inside the tablix which is intended to display the data in hh:mm format.

    Thanks & Regards,
    Prasanna Vaitheswaran


    Please mark the post as 'Answer', if it addresses or resolves your query. Please click on 'Vote as Helpful', if it is helpful.

    • Marked as answer by Jstrack13 Thursday, February 7, 2013 2:46 PM
    Wednesday, February 6, 2013 10:12 PM
  • Hi,

    It would be something like this :

    CStr(Int(T/36000000)) + ':' + CStr(Int((T - 3600000*Int(T/36000000)) / 60000))


    Sebastian Sajaroff Senior DBA Pharmacies Jean Coutu

    Thursday, February 7, 2013 1:12 PM