Sequenzia
Sequenzia

Reputation: 2381

Date format in HTML cfgrid or SQL date format

I am trying to format dates in an HTML cfgrid. I cannot seem to make it work in CF when using HTML as the grid type. I have also tried doing it in MSSQL by using - CONVERT(VARCHAR(10), startDate, 101) AS startDate.

When I do that it shows up right in the grid but the grid will not sort on the date properly.

I understand why converting it to varchar screws up the sort but I cannot seem to make this work in either CF or SQL.

Anyone know of a way to make it show up in the grid in a mm/dd/yyyy format and also sort on the date properly?

Upvotes: 4

Views: 2394

Answers (3)

Pope Jimbo
Pope Jimbo

Reputation: 21

If you are using an html cfgrid, you need to use the formats found in the Ext JS Date class. NOT the date format for Flash.

Here is a link to the Ext JS Date class

Upvotes: 2

Saul
Saul

Reputation: 1397

Ability to use the mask attribute in html grids was added in CF9. To get it to work on dates you also have to specify type=date

<cfgridcolumn mask="m/d/Y" type="date" ... >  

Upvotes: 4

Dan Roberts
Dan Roberts

Reputation: 4694

<cfgridcolumn ... mask="mm/dd/yy">

source

Upvotes: 0

Related Questions