开发者

Format date on x-axis in cfchart

开发者 https://www.devze.com 2023-01-03 05:12 出处:网络
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).

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

精彩评论

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