Convert text YYYY-MM to MMMM, YYYY and concatenate with text.

alhowarthWF 296 Reputation points
2021-09-29T16:19:16.75+00:00

I use the format YYYY-MM in a parameter to choose the year/month. And I have the following expression on the top of my report:

="This report is for the month " & Parameters!MnthYr.Value

Which shows "This report is for the month 2021-08"

I would like to list out the full month and year, so it states (for example) "This report is for the month August, 2021"

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,807 questions
0 comments No comments
{count} votes

Accepted answer
  1. DJAdan 671 Reputation points
    2021-09-29T21:38:04.913+00:00

    Hi alhowarthWF,

    If your MnthYr parameter is a datetime, this is simple.

    Otherwise, you will have to do some string parsing, as the string 2021-08 is not a standard date.

    You could try this function:

    ="This report is for the month " 
    + Switch
        (
            Right(Parameters!MnthYr.Value,2) = "01", "January",
            Right(Parameters!MnthYr.Value,2) = "02", "February",
            Right(Parameters!MnthYr.Value,2) = "03", "March",
            Right(Parameters!MnthYr.Value,2) = "04", "April",
            Right(Parameters!MnthYr.Value,2) = "05", "May",
            Right(Parameters!MnthYr.Value,2) = "06", "June",
            Right(Parameters!MnthYr.Value,2) = "07", "July",
            Right(Parameters!MnthYr.Value,2) = "08", "August",
            Right(Parameters!MnthYr.Value,2) = "09", "September",
            Right(Parameters!MnthYr.Value,2) = "10", "October",
            Right(Parameters!MnthYr.Value,2) = "11", "November",
            Right(Parameters!MnthYr.Value,2) = "12", "December",
            True, ""
        ) + ", " 
    + Left(Parameters!MnthYr.Value,4)
    

    Just place the above code snippet into your text box.

    I hope this helps.

    --Dan


1 additional answer

Sort by: Most helpful
  1. Isabellaz-1451 3,616 Reputation points
    2021-09-30T06:51:38.773+00:00

    Hi @alhowarthWF

    DJAdan-4490 has send you an answer.

    Best Regards,
    Isabella


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments