I am strongly typing my DataTable DateTime columns and then transforming the DataTable into an Object[,] and pasting into Excel. My problem is that in some cases the date shows in US format and in others UK format. What is the standard practise for doing this operation and making sure that the correct date is pasted down but also maintaining the type of the column?
I am strongly typing my DataTable DateTime columns and then transforming the DataTable into
Share
With C# Excel Interop, you can set the Format of a cell or a range of cells with the
NumberFormatproperty.This is just a string, and is the same thing that you would type into Excel if you right clicked on a cell, or a range of cells and selected the
Customcategory, and then typed in a format.You could ensure that a Date in a cell always has the same format by simply doing the below: