none
Convert time to format mm:ss with Report Builder RRS feed

  • Question

  • Hello!

    Could you please help me? I would like to convert time format to mm:ss (minutes:seconds). I created a table with Report Builder. The result is the difference of end time and start time. For example i would like to see 00:05 (5 minutes) instead of 00:05:38.0800000. I tried to set up in Text Box Properties: with choosing Time format, but nothing changed.

    Thanks in advance!

    Thursday, September 19, 2019 12:58 PM

All replies

  • =Format(DateAdd("s", Fields!MyTimeField.Value, "00:00"), "HH:mm")

    Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/

    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting: Large scale of database and data cleansing
    Remote DBA Services: Improves MS SQL Database Performance
    SQL Server Integration Services: Business Intelligence

    Thursday, September 19, 2019 1:08 PM
  • You can use an expression like

    =DateAdd(DateInterval.Minute,Fields!YourTimeDiffColumn.Value,CDate("01/01/1900"))

    Then choose appropriate format for the textbox from properties as below


    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    ----------------------------
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

    Thursday, September 19, 2019 1:22 PM
  • Hi Hajnalka70,

    According to my understanding, the format you want to get is hh:mm. And it should be calculated by the difference of end_time and start_time. If so, you could try my expression below.

    =DateDiff(DateInterval.Hour,Fields!start_time.Value, Fields!end_time.Value) 
    & ":" & 
    DateDiff(DateInterval.Minute,Fields!start_time.Value, Fields!end_time.Value) 
    Mod 60

    Please have a try.

    Regards,

    Zoe


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Friday, September 20, 2019 6:58 AM
  • Hi Hajnalka70,

    Have you resolve your issue? Would you kindly give us some feedback?

    If you found above answer is helpful, please mark it as answer, this can be beneficial to this community.

    Regards,
    Zoe

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Friday, September 27, 2019 7:37 AM