Excel

Wednesday, December 7, 2011

SSRS Custom code to convert the Integer values into “Days:HH:MM” format


To Convert the Integer values into “Days:HH:MM” format:

Write the following VB.Net code in Custom Code area (Right click on report -> Report Properties -> Code)


Function MinToDDHHMM(iValues  as integer) as String
        Dim mDay,  iHour As Integer
        Dim mMinute As Integer
 If mValue >= (24 * 60) Then
            mDay = mValue \ (24 * 60)
            mValue = mValue Mod (24 * 60)
 End If
 If mValue >= 60 Then
            mHour = mValue \ 60
            mValue = mValue Mod 60
  End If
mMinute = mValue
MinToDDHHMM = IIF(mDay>9,iDays, "0" & mDay) &  ":" & IIF(mHour>9,mHour, "0"&mHour) & ":" &
                                                        IIF(mMinute>9 ,mMinute,"0" &mMinute)
End Function

Now, use the following value expression “ =Code.MinToDDHHMM(Fields!TotalMinutes.Value) in the report area.

(Considered that the field “TotalMinutes” contains the minute value to be converted into Days:HH:MM format.)

Result : You will get the minute value “1505” as “01:01:05”

2 comments:

  1. You should participate in a contest for the most effective blogs on the web. I will advocate this website! casino blackjack

    ReplyDelete
  2. I'm Абрам Александр a businessman who was able to revive his dying lumbering business through the help of a God sent lender known as Benjamin Lee the Loan Consultant. Am resident at Yekaterinburg Екатеринбург. Well are you trying to start a business, settle your debt, expand your existing one, need money to purchase supplies. Have you been having problem trying to secure a Good Credit Facility, I want you to know that Mr Benjamin will see you through. Is the right place for you to resolve all your financial problem because am a living testimony and i can't just keep this to myself when others are looking for a way to be financially lifted.. I want you all to contact this God sent lender using the details as stated in other to be a partaker of this great opportunity Email: 247officedept@gmail.com  Or  WhatsApp/Text +1-989-394-3740.

    ReplyDelete