DataTable dt = TypeConveriontHelper.ConvretExcelToDataTable(SourceAppFilePath);
string targetPath = BatchFolderPath + @"\" + "TRANSACT.INX";
StreamWriter wrtr = null;
wrtr = new StreamWriter(targetPath);
for (int x = 0; x < dt.Rows.Count; x++)
{
string rowString = "";
for (int y = 0; y < dt.Columns.Count; y++)
{
if (y == dt.Columns.Count - 1)
{
rowString += "\"" + dt.Rows[x][y].ToString() + "\"";
}
else
{
rowString += "\"" + dt.Rows[x][y].ToString() + "\"~";
}
}
rowString = rowString.Replace("\"", String.Empty).Trim();
wrtr.WriteLine(rowString);
}
wrtr.Close();
wrtr.Dispose();
数据表返回“日期”列,其中包括时间和日期。但我只需要显示日期。给我一个解决方案。谢谢。