Search code examples
crystal-reportscrystal-reports-2008crystal-reports-2010

Bad date format string string error


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


Solution

  • try this..

    "From : " & ToText(Minimum({?date}), "dd/MM/yyyy") & 
    " To :" & ToText(Maximum({?date}), "dd/MM/yyyy")
    

    If the datetime is in field (not a formula) then you can format it:

    Right click on the field -> Format Editor Date and Time tab Select date/time formatting you desire (or click customize) If the datetime is in a formula:

    ToText({MyDate}, "dd/MMM/yyyy")
    //Displays 31/Jan/2010
    

    or

    ToText({MyDate}, "dd/MM/yyyy")
    //Displays 31/01/2010
    

    or

    ToText({MyDate}, "dd/MM/yy")
    //Displays 31/01/10
    

    etc...