G
Guest
I am writing a DataTable to a file using a stringbuilder.
The Format of the date in the table is like this: '12/20/04'
But after I write it to the file it ads the time: '12/20/04 12:00:00 AM'
My code looks like this
for(int curRow = 0; curRow < dt1.Rows.Count; curRow++)
{
for(int curCol = 0; curCol < dt1.Columns.Count; curCol++)
{
sb = sb.Append(dt1.Rows[curRow][curCol].ToString().Trim()).Append(delim);
}
sb.Append(Environment.NewLine);
}
f.WriteLine(sb.ToString());
f.Close();
I know there is something like .toshortdate, but I don't know where to put it.
ANy ideas
Thanks
PAul
The Format of the date in the table is like this: '12/20/04'
But after I write it to the file it ads the time: '12/20/04 12:00:00 AM'
My code looks like this
for(int curRow = 0; curRow < dt1.Rows.Count; curRow++)
{
for(int curCol = 0; curCol < dt1.Columns.Count; curCol++)
{
sb = sb.Append(dt1.Rows[curRow][curCol].ToString().Trim()).Append(delim);
}
sb.Append(Environment.NewLine);
}
f.WriteLine(sb.ToString());
f.Close();
I know there is something like .toshortdate, but I don't know where to put it.
ANy ideas
Thanks
PAul