How to use Calendar.GetDaysInMonth() Method in report expressions

  • I am a newbie to MS reporting services.

    How can I use Calendar.GetDaysInMonth()  in a report expression.

    I need to calculate the number of days in a datetime field and found the above method in VB reference library.

    Can anybody provide a guide for proper use?

  • Something along the lines of

    =Calendar.GetDaysInMonth(Calendar.GetYear(Fields!<your_dt_field>.Value), Calendar.GetMonth(Fields!<your_dt_field>.Value))

    The above uses the the GetYear to determine the year from your datetime field value and then the month number (1 based) to get the month, both of which are required for the GetDaysInMonth fn.

    Steve.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply