Skip to main content
Inspiring
March 30, 2011
Question

Date formatting issue in Generated Excel

  • March 30, 2011
  • 1 reply
  • 545 views

Hi All,

I'm generating a report by getting the values from the query and looping over it.

This is my code.

<cfheader name="Content-Disposition" value="inline; filename=testReport.csv">
        <cfcontent type="text/x-excel-csv"><cfoutput><cfloop index="i" list="#columnstrings#">"#i#",</cfloop></cfoutput>
        <cfoutput QUERY="downloadquery">#chr(13)#<cfloop index="i" list="#columnstrings#">"#replace(evaluate('#i#'),'"',"'","ALL")#",</cfloop></cfoutput>

All the columns are coming perfectly, but the date column is showing 0:00:00 in the generated excel.

The user has to do a manual formatting for the date columns.

We are using coldfusion 9 and Oracle 10G

Any help would be appreciated.

When i check the dump the query, the date columns are coming correctly.

Only the excel does not know that its a date column.

    This topic has been closed for replies.

    1 reply

    Inspiring
    March 30, 2011

    Try prepending an apostrophe.