SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have 2 datetime Fields in SSRS and I am summing both of them like: =TimeSpan.FromTicks(sum(Fields!Logout_Time.Value-Fields!Login_Time.Value)).

The output is correct but is in hh:mm:ss format, I need it to be hh:mm format.

share|improve this question

The below formula calculates this. Don't forget first to calculate your time field in seconds.

=CSTR
(
    (
        Floor
            (
                Sum(Fields!YourTimeField.Value)/3600
            )
    )
)
+ ":"+
IIf
    (
        Floor
            (
                (
                    Sum(Fields!YourTimeField.Value)
                    -
                    (
                        Floor
                            (
                                Sum(Fields!YourTimeField.Value)/3600
                            )*3600
                    )
                )/60

            )<10

    ,
        "0"+    
        CSTR
            (
        Floor
            (
                (
                    Sum(Fields!YourTimeField.Value)
                    -
                    (
                        Floor
                            (
                                    Sum(Fields!YourTimeField.Value)/3600
                            )*3600
                    )
                )/60

            )
            )
        ,
    CSTR
        (
        Floor
            (
                (
                    Sum(Fields!YourTimeField.Value)
                    -
                    (
                        Floor
                            (
                                Sum(Fields!YourTimeField.Value)/3600
                            )*3600
                    )
                )/60

            )       
        )
)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.