reporting-services

How do I format date on ssrs report?


In an SSRS report I need to show today's date and current time.

I tried this =Day =Mouth and =Year but this is not working, it is giving an error.

How can I write this expression ?

I want output display like this: 20th day of June 2024


Solution

  • For a text box value, there can only be one expression. You can use a date function but need to speciify the date field. The different parts can be combined with an & sign for text.

    =Day(Fields!DATE_FIELD.Value) & "th day of " & MonthName(Month(Fields!DATE_FIELD.Value), 0) & " " & Year(Fields!DATE_FIELD.Value)
    

    The Month function returns the month number so the MonthName function is needed to convert the number to a name.

    Unfortunately, there's not an automatic function for the "th" for 1st, 2nd, 3rd so you may need to add a SWITCH function for Fields!DATE_FIELD.Value MOD 10 to identify those and use the right suffix.