I want to convert the string value to datetime in crystal report
date format are
05-10-7-AAAA (mm-dd-year(2017)-AAAA)
05-23-3-00 (mm-dd-year(2013)-
Create a new Formula and apply the code below. {Command.mydate} will be replaced with your field
local StringVar mDate;
local StringVar mMonth;
local StringVar mDay;
local StringVar mYear;
//local StringVar mSuffix:= StrReverse(left(StrReverse({Command.mydate}),instr(StrReverse({Command.mydate}),"-",1)-1)); // to get suffix
mDate:= left({Command.mydate},InStrRev ({Command.mydate},"-" )-1); // get dd
mMonth:= left(mDate,2); // get MM
mDay := Mid (mDate,4 ,2 ); // get YYYY
mYear := totext(2010 + CDbl (right(mDate,InStr(StrReverse(left({Command.mydate},InStrRev ({Command.mydate},"-" )-1)),"-") -1 )),0,""); // transform 2017
cDate(cDbl(mYear),cDbl(mMonth),cDbl(mDay)); // this will display dd-MM-YYYY may not display as 01 for dd but you can always customise this in the GUI the important point is this is now a date field