So I was pulling in date entries from a MySQL database and needed to display the date differently via Coldfusion depending on which group the entry belonged to. For the “yearly” entries, I only wanted to show the year, for the rest, I wanted the standard “7/22/2007″ format. The solution? Put in a cfif that checked to see which group the entry belonged to. Depending on which one, the varaible would be formatted differently, like so:
<cfif #VARIABLES.subSelected# is 3>
<cfset formatdate = dateformat(date, “yyyy”)>
<cfelse>
<cfset formatdate = dateformat(date, “m/d/yyyy”)>
</cfif>