开发者

Format date on x-axis in cfchart

I want to fo开发者_开发百科rmat the date on the x-axis of my cfchart as mm/yyyy as opposed to the full datetime value that is returned from sql server (yyyy-mm-dd hh:mm:ss).

How do I do this?


I haven't dealt with this in a while, but I recall post-processing the date fields in a special "clean things up for cfchart" loop. So, given query q and datefield thedate one approach would be to loop through the query, replacing your date values with sanitized date values. Something like:

<cfloop from="1" to="#q.recordcount#" index="i">
    <cfset q.thedate[i] = dateformat(q.thedate[i],'mm/yyyy')>
</cfloop>

Depending on what your data look like, you may want to do further tweaks, like re-sorting the recordset with query-of-queries, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜