Neca24
Neca24

Reputation: 49

Convert string to date SSRS

I have issue converting parameter string to date.

I have list of data as:

Jul 28 2017  Call
Jan  8 2018  SMS
Apr 24 2018  Call
Jul  2 2018  E-Mail
Jul 13 2018  Call
Oct  1 2018  Call
Nov 27 2018  E-Mail
Dec 31 2018  Call
Jan  1 2019  SMS
Apr  1 2019  SMS
Jun  4 2019  SMS

I want them to be presented as eg. 06/04/2019 if possible

I tried LSet(Format(Parameters!DateInfo.Label,"MM/dd/yyyy"),12) in expression, but when I run the report it is showing me just like this MM/dd/YYYY.

Upvotes: 1

Views: 10673

Answers (1)

Hannover Fist
Hannover Fist

Reputation: 10860

For your parameter, you probably should be using a dataset for the dates with the Value set to use a date field and the Label using the string representation of the date (CONVERT(CHAR(10), THEDATE, 110) AS DATE_LABEL).

I'm guessing the user isn't typing the parameter values in which means that there's already a dataset for the dates. Add another column to the dataset with the date as a date field to use as the Value while using the text as the Label.

If you cannot fix that and still need to convert the text field into a date, you could use the CDATE function which will convert text into a date field.

=Format(CDATE(LEFT(Parameters!DateInfo.Label, 12)),"MM/dd/yyyy")

Upvotes: 2

Related Questions