RE: When I Import Time field from Excel to AX Tmp Table Its coming as 0 or 12:00:00 AM
Hi Karthick,
The code cells.item(row, 7).value().time() may not convert the data as expected if the cell in the excel is not properly formatted. The ideal way would be to do in following way:
COMVariant variant = cells.item(currentRow, 3).value();
switch (variant.variantType())
{
case COMVariantType::VT_R4 :
realValue = _variant.float();
break;
case COMVariantType::VT_R8 :
realValue = _variant.double();
break;
case COMVariantType::VT_DECIMAL :
realValue = _variant.decimal();
break;
case COMVariantType::VT_BSTR :
timeHour24 = str2time(_variant.bStr());
break;
case COMVariantType::VT_EMPTY:
break;
default:
throw error(strfmt("@SYS26908", _variant.variantType()));
}
timeHour24 = any2int(#secondsPerDay * realValue);