Skip to main content
Participating Frequently
February 25, 2011
Question

Formatting date cfgrid

  • February 25, 2011
  • 1 reply
  • 2117 views

Using ColdFusion 9 and SQL Server 2008. Have cfgrid with dates. The date columns are not displayed but text boxes are bound to those columns and are displayed. The SQL Server data types are datetime which store in this format - mm/dd/yyyy hh:mm:ss. The cfgrid displays the date as

2011-01-20 14:52:32.167. In the cfgrid code I have tried "mask" and "number format" and neither alter the date display. Any suggestions?

Could I possibly change the format in the text boxes. I use the data in the text boxes for emails and a more conventional date presentation would better suit the email.

Thank you - JS

sample code for cfgrid

<cfgrid name="reqInfo" query="Req" width="510" visible="yes" format="html" rowheaders="yes" rowheaderwidth="50" selectcolor="orange" selectmode="row" maxrows="25" colheaderbold="yes" colheadertextcolor="Blue" selectOnLoad="no">
  <cfgridcolumn name="ID" width="8" display="no" />
  <cfgridcolumn name="PIN" display="no" />
  <cfgridcolumn name="Name" header="Name" headerfontsize="14px" width="150" />
  <cfgridcolumn name="RequestDate" header="Request Date" dataalign="center" headerfontsize="14px" width="115" mask="mm/dd/yyyy" />
  <cfgridcolumn name="BeginDate" header="Begin Date" display="no" headerfontsize="14px" width="90" numberformat="mm/dd/yyyy" />

There's more but this gets the point across.

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    February 25, 2011

    Found the answer for cfgrid date formatting when format is html. Enter mask="mm/dd/yyyy" and immediately after that enter type="date".

    February 14, 2017

    Hi,

    We have a cfgrid with date column

    the date column is not getting sorted in date format.it is getting sorted in string format.we are using the following mask= "y-m-d" type="date"

    BKBK
    Community Expert
    Community Expert
    February 14, 2017

    @Girishk55972628, this thread is old and is on formatting; your question is on sorting. You should start a new thread.