0

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.

0

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

            )       
        )
)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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