Date format in ColdFusion

I have a used ‘CFGRID’ with ‘CFGRIDCOLUMN’ using the ‘parks’ from ‘cfdocexamples ‘database
In the code I pull in the dateestb field and all works fine. I need to format the date to display dd ddd mmm yyy.
How can I do this, can anyone help.
( I have attached code I am using in 2 pages, a cfm and a cfc)
<!--- Code saved as demo.cfm --->

<cfform name="parkForm">
	<cfgrid format="html" name="parkGrid" pagesize="10" selectmode="row" bind="cfc:calender.getParks({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})">
		<cfgridcolumn name="parkName" width="300" header="Name" />
		<cfgridcolumn name="parkType" width="180" header="Type" />
		<cfgridcolumn name="city" width="120" header="City" />
		<cfgridcolumn name="state" width="60" header="State" />
        <cfgridcolumn name="dateestb" width="150" header="Date Est" />
	</cfgrid>
</cfform>
<!--- End Code saved as demo.cfm --->

<!--- Code saved as calender.cfc --->
<cffunction name="getParks" access="remote" returntype="struct">
	<cfargument name="page" required="true" />
	<cfargument name="pageSize" required="true" />
	<cfargument name="gridsortcolumn" required="true" />
	<cfargument name="gridsortdirection" required="true" />
	
	<cfif arguments.gridsortcolumn eq "">
		<cfset arguments.gridsortcolumn = "parkName" />
		<cfset arguments.gridsortdirection = "asc" />
	</cfif>

	<cfquery name="parks" datasource="cfdocexamples">
		select		parkName, parkType, city, state, dateestb
		from		parks
		order by	#arguments.gridsortcolumn# #arguments.gridsortdirection#
	</cfquery>

	<cfreturn queryconvertforgrid(parks, page, pagesize) />
</cffunction>
<!--- End Code saved as calender.cfc --->

Open in new window

LVL 5
john_hollingsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

azadisaryevCommented:
there are 2 ways you can approach this:

1) use db-specific date functions to get the date in preferred format from db.
unfortunately, apache derby db (which is the db of the cfdocexamples that ships with cf8+) does not have necessary built-in functions to return a date in your preferred format. but other dbs (ms sql, mysql, etc) all have them

for an explanation and example read this:
http://www.garyrgilbert.com/blog/index.cfm/2007/7/3/QueryConvertForGrid-date-format-woes

2) use a custom grid cell renderer to re-format the date cell in your preferred format.
explanation and example can be found here:
http://www.coldfusionguy.com/ColdFusion/blog/index.cfm/2007/11/27/CFGrid-Custom-Date-Renderer

Azadi
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
john_hollingsAuthor Commented:
Tanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development Software

From novice to tech pro — start learning today.