ssrs-expressionssrs-2017

Date format in SSRS Expression


I am trying to change the date format for one of my field to dd/MM/yyyy but every time I used the below expression I get dd/MM/yyyy as the value in the cell instead of changing the format.

The data source that I am using is Teradata.

Expression used: =Format(FormatDateTime(Fields!DATE.Value, DateFormat.ShortDate),"dd/MM/yyyy")

Can some one help me with where am I going wrong. Any help would be appreciated.


Solution

  • The FormatDateTime function returns a string instead of a date. When the FORMAT function tries to format it, it doesn't find a date field so it returns the characters in the format.

    If your field is a date, you should be able to format the field without conversion:

    =Format(Fields!DATE.Value,"dd/MM/yyyy")
    

    If it does need to be converted first, try using the CDATE function:

    =Format(CDATE(Fields!DATE.Value),"dd/MM/yyyy")