Hi expert,
I have csv file which will send date as below format only,i.e. cannot ask user to make any changes in this format .
I also have code to convert date to Ax acceptable date which works when the format of date is as date in CSV but not for below scenario.
Please suggest how do i fix this in way that the below CSV format is converted into Ax date format currently it keeps throwing the error from dateNull() code block
CSV format

AX code for converting to Ax acceptable date format. (Validto Date.)
Please note mytable.myDate EDT is Validto Date.
My Main class
{
myTable.myDate = this.ConvertDates(conPeek(_record,9));
if (myTable.myDate == dateNull())
{
throw error(strFmt('%1 Error Invalid Date',DateTimeUtil::getSystemDateTime()));
}
}
protected date convertDates(str dateTime)
{
try
{
if (strLen(datetime) > 10)
{
return DateTimeUtil::date(str2DateTime(datetime,321));
}
else
{
return str2date(datetime,213);
}
}
catch (Exception::Error)
{
throw error (strfmt("@SYS63093",funcName()));
}
}