cancel
Showing results for 
Search instead for 
Did you mean: 

Bad date format string string error

Former Member
0 Kudos

Hi,

     I created an asp application with crystal report. In that dates are stored as varchar in sql, and pass that value as string from asp to crystal report. Here that string format is converted to date by using Datevalue function. But i try to execute the report it shows bad date format string error. date format stored in sql is 'dd/mm/yyyy'

How to convert the string to date value in crystal report

Accepted Solutions (1)

Accepted Solutions (1)

DellSC
Active Contributor
0 Kudos

If your date string is always dd/mm/yyyy, try this:

If not IsNull({date string field}) and {date string field} <> "" then

  Date(ToNumber(Right({date string field}, 4), ToNumber(Mid({date string field}, 4, 2)), ToNumber(Left({date string field}, 2)))

This will return null if there is no value in the string and a date if there is.

-Dell

Answers (0)