Export to Excel Date Format for UK
-
Hi, My web application exports a
List
of objects to an Excel spreadsheet by creating aDataGrid
and binding it to theList
. The objects that theList
contains include columns whose type isDateTime
and while the resulting spreadsheet correctly lists all the objects, the date format is US instead of UK (which is what I want) - to be expected really. I can, of course, create a new object class and copy each object in theList
to a secondList
of these new object types and bind theDataGrid
to that but I'll have to do the same for every list of object types I want to export. Can anyone suggest a simple method to resolve this issue? Thanks :)Evil cannot be conquered in the world... It can only be resisted within oneself.
-
Hi, My web application exports a
List
of objects to an Excel spreadsheet by creating aDataGrid
and binding it to theList
. The objects that theList
contains include columns whose type isDateTime
and while the resulting spreadsheet correctly lists all the objects, the date format is US instead of UK (which is what I want) - to be expected really. I can, of course, create a new object class and copy each object in theList
to a secondList
of these new object types and bind theDataGrid
to that but I'll have to do the same for every list of object types I want to export. Can anyone suggest a simple method to resolve this issue? Thanks :)Evil cannot be conquered in the world... It can only be resisted within oneself.
Simplest method turned out to be iterating through the list, parsing any
DateTime
fields with theDateTime.Parse()
method specifying"en-GB" CultureInfo
as theDateTimeFormat
parameter :cool:Evil cannot be conquered in the world... It can only be resisted within oneself.