none
To Display Month Name and Year instaed of complete date...in SSRS Reports

    Question

  • Hi All,

               I have a sample data like this..I have added the cases for the particular worker in the table..My question is that when displaying the cases for the particular month...the date should not be displayed..instead of date 2008-04-30 I have to display...like April 2008...if the date is 2008-10-20...it should display as October 2008...can anyone please help me with this...

    312   KRISTI  WHITE                 865400           2008-04-30   2
    312   KRISTI  WHITE                 1000264311    2008-04-30   3
    312   KRISTI  WHITE                 1000430815    2008-04-30   1
    312   KRISTI  WHITE                 1000660614    2008-04-30   1
    312   KRISTI  WHITE                 1002371318    2008-04-30   2
    312   KRISTI  WHITE                 2003722520    2008-04-30   4

     

     

    Thanks

    Chaitanya.

     

    Tuesday, May 06, 2008 3:50 PM

Answers

  • The Format function can only format numeric or DateTime values.  In your case it seems the Date value is actually returned as a string value from your data source/query.

     

    You can try to convert the string to a DateTime object using the CDate() function.

     

    For example:

    =Format(CDate(Fields!A.Value), "MMMM yyyy")

     

     

    -- Robert

    Wednesday, May 07, 2008 4:17 PM
  • hello

     

    an alternative you coud try

     

    =string,format("{0:MMMM yyyy}",cdate(<your value>))

     

    Wednesday, May 07, 2008 4:47 PM

All replies

  • You can apply .NET formatcodes on the Format property of textboxes, or use the Format function directly in an RDL expression, e.g. =Format(Fields!Date.Value, "MMMM yyyy")

     

    More info about DateTime format codes is available on MSDN:

    * http://technet.microsoft.com/en-us/library/aa720651.aspx

    * http://technet.microsoft.com/en-us/library/aa719856.aspx

     

    -- Robert

     

     

    Tuesday, May 06, 2008 4:27 PM
  •  

    Hi Robert,

                    Thanks for your reply...But when I am trying the Format function ehich you gave the date is being diplayed as MMMM YYYY......So, Please help if there is any other alternation...which displays the Month Name..

     

    Thanks

    Dotnetdev1

    Wednesday, May 07, 2008 1:33 PM
  • Use this
    Format(Parameters!Month1.Value,"M")
    Wednesday, May 07, 2008 2:37 PM
  • The Format function can only format numeric or DateTime values.  In your case it seems the Date value is actually returned as a string value from your data source/query.

     

    You can try to convert the string to a DateTime object using the CDate() function.

     

    For example:

    =Format(CDate(Fields!A.Value), "MMMM yyyy")

     

     

    -- Robert

    Wednesday, May 07, 2008 4:17 PM
  • hello

     

    an alternative you coud try

     

    =string,format("{0:MMMM yyyy}",cdate(<your value>))

     

    Wednesday, May 07, 2008 4:47 PM
  • =Monthname(Datepart("m", Fields!DATE.Value)) & " " & Datepart("yyyy", Fields!DATE.Value)

    January 2011

    =Monthname(Datepart("m", Fields!ADATE.Value)) & VbCrLf & Datepart("yyyy", Fields!ADATE.Value)

    January

    2011

    Thursday, March 29, 2012 12:59 PM
  • simply use:  =Format(Fields!DATE.Value,"MMMM yyyy")

    no need to deal with the datepart. fyi


    Think out of the box

    • Proposed as answer by Suryaganth Saturday, July 14, 2012 12:26 PM
    Thursday, March 29, 2012 2:08 PM
  • FYI ..,

    select getdate() as 'Current DateTime',datename(m,getdate())as 'MonthName',datepart(d,getdate()) as 'Date',datepart(month,getdate()) as 'Month Number',datepart(YY,getdate()) as 'Year',datepart(Hour,getdate()) as 'Hour',datepart(Minute,getdate()) as 'Minute',datepart(S,getdate()) as 'Seconds',datepart(ms,getdate()) as 'MilliSeconds' , datepart(y,getdate()) as 'Julian Dt'

    Saturday, July 14, 2012 12:27 PM