Change Date/Time format in CSV Export to UK DD/MM/YYYY

391 views
Skip to first unread message

heresandyboy

unread,
Feb 6, 2008, 7:27:43 AM2/6/08
to Sinergia Help Desk
Hi, I am in the process of customising Sinergia to suit our small
business. Thanks for all your efforts on the project, saved me a
massive job in coming up with a solution, everything else I looked a
pales in comparison!
I am having fun with it and have achieved a lot in the last week or so
already.
I could do with a bit of a hand (step by step is good hehe) in editing
the btnCSV_Click Line 87 onward in CasesReport.aspx.cs so that any
date time format is shown in UK style DD/MM/YYYY. I know how to
acheive this easily in TSQL but clueless in C# im afraid.
I look forward to your response :)

gabouy

unread,
Feb 6, 2008, 8:13:06 AM2/6/08
to sinergia-...@googlegroups.com
Hi there,

ok, the code block you mention btnCSV_Click is responsible for: retrieving list of cases with one specific filter, and applying an xslt transformation to render it as a CSV file. The XSLT transformation is pretty dummy, there is no hardcoded reference to a specific locale so I think it´s taken either from the web server or the client machine, meaning if your server language is en-us then date format will be american like: MM/DD/YYYY

Please check this out,

BTW thank you for the feedback, and if there´s any piece of code you think is worth sharing let me know

regards,
gabo

heresandyboy

unread,
Feb 11, 2008, 6:53:37 AM2/11/08
to Sinergia Help Desk
Hi Gabouy,
Thanks for the reply. I am still struggling with this particular
problem. Currently my CSV export (with changed delimiter from ; to ,
already to fit uk excel etc) has dates that come through with the
format like "2008-02-11T11:03:41.25+00:00", I really would like any
exported CSV files to have a friendly format like "DD/MM/YYYY hh:mm"
or something as close to that as possible. Could you assist in
achieving this? Can the date format be controlled in the
CasesReport.aspx.cs file, the report_csv.xslt file or perhaps in the
database itself, im not sure where to start aproaching this issue. Im
not familliar with the type of format the dates are coming out as at
the moment and cant see how to current output is related to the server
lang/format.

Ta much

Andy

gabouy

unread,
Feb 11, 2008, 7:44:22 AM2/11/08
to sinergia-...@googlegroups.com
Hi Andy,

The way I see it you have two options, either rewrite the method  btnCSV_Click, loop through the ListCases dataset, and write to the response output exactly what you want with C# code. This should be simple enough.

Or format the date output from the xslt, with xslt logic.

regards,
gabo
--
http://blog.gabouy.com
Reply all
Reply to author
Forward
0 new messages