Report Builder 3.0: how to convert string representation of dates in mm / dd / yy format using CDate

I am creating a report using Report Builder 3.0.

The source system I'm working with has strings representing dates in a format mm/dd/yy, but I want to show this to end users how dd-MMM-yy. Using CDatein a string will give me errors, because it interprets the string in a format dd/mm/yy(US regional settings).

Is there a way to correctly convert a string to a date without changing the regional settings (this is not an option)?

Thank!

+5
source share
1 answer

You can use the command Formatand specify the desired format. For instance:

=Format(Cdate(Fields!Date.Value),"dd-MM-yyyy")

or you can try the following:

=Day(Fields!Date.Value) & "/" & Month(Fields!Date.Value) & "/" & Year(Fields!Date.Value)

EDIT: Everything's OK:

=Cdate(Mid(Fields!Date.Value,4,2) & "/" & Mid(Fields!Date.Value,1,2) & "/" & Mid(Fields!Date.Value,7,4))
+9
source

All Articles