In sql there is a record in the format:
2012-06-13 08:30:00.000
When I export it to Excel, it appears in this format:
2012-07-18T08:30:00+03:00
How can I fix it?
I use MSSQL. Here is the c# code: (I use RKLib.ExportData component)
int[] iColumns = { 0, 1, 2, 3, 4, 5, 6 };
RKLib.ExportData.Export objExport = new RKLib.ExportData.Export("Web");
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentEncoding = System.Text.Encoding.GetEncoding("windows-1254");
Response.Charset = "windows-1254";
objExport.ExportDetails(dt, iColumns, RKLib.ExportData.Export.ExportFormat.Excel, "exceldocument.xls");
I don’t think this is related to the export. According to the documentation the first parameter there is a
DataTable, in your casedt.Wherever else in your code you are creating and populating this datatable, you should be able to sort the formatting there. Somewhere between the database and this datatable is where the extra bit is being added.
You haven’t mentioned what the datatype of the column it came from, or the datatype of the column in the
DataTableit’s going into, but I’m going to assume that the source column is aDateTimein your database, but it ends in a string column in your datatable? If this is true, you could use string manipulation on the datatable column, or change the sql that populates it to get it in the format you would like.