Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

1 Answer 1

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.