views:

17

answers:

1

I want to format 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?

+2  A: 

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.

Ken Redler
I ended up formatting the date on the SQL Server side. Thanks though!
dmr