CF 10生成的电子表格将日期显示为文本

时间:2016-08-17 19:05:35

标签: excel coldfusion

团队 - 关于如何在数据库查询中通过Coldfusion生成的excel文件中获取日期格式的任何想法。以下是部分代码

   <cfset formathr = structnew()/>
   <cfset formathr.bold = "true"/>
   <cfset formathr.alignment = "center"/>
   <cfset formathr.bottomborder = "double"/>
   <cfset formathr.fgcolor = "pale_blue"/>
   <cfset formattotr = structnew()>
   <cfset formattotr1 = structnew()>
   <cfset format = structnew()>
   <cfset formatdatecolumn = structnew()>
   <cfset formatdatecolumn.dataformat = "mm/dd/yyyy"/>
   <cfset formattotr.alignment = "center"/>
   <cfset formattotr.topborder = "double"/>

    <cfset sobj = SpreadSheetNew("true")/>

   <cfset SpreadsheetAddrow(sobj,"id,name,team,datejoined,dateretired,amount, maintaincost, noyears")/>
    <cfset SpreadsheetFormatRow(sobj, formathr,"1")/>            
    <cfset SpreadsheetAddRows(sobj, QryName)/>
    <cfset formattotr1.dataformat = "##,##0"/>`enter code here`
    <cfset SpreadsheetFormatColumn(sobj, formatdatecolumn, "4-5")/>

在这里和其他地方尝试了很多选项,但仍然没有运气。

更新

我意识到日期在我的情况下可能是空白的,因此我遇到了格式问题。以下是我的查询

 CASE 
      WHEN e.DateRetired=0 THEN NULL 
      ELSE TO_CHAR( TO_DATE('01-01-1970','DD-MM-YY') + ( e.DateRetired/ 86400000 )
                    , 'MM/DD/YYYY'
               ) 
 END AS DateRetired

0 个答案:

没有答案