Skip to main content
Participating Frequently
Feb 25, 2011 5:59 PM UTC
Question

Formatting date cfgrid

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 is closed to new replies. Start a new post to keep the conversation going.

    3 replies

    Participating Frequently
    Feb 25, 2011 6:44 PM UTC

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

    Translate
    Feb 14, 2017 12:12 PM UTC

    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"

    Translate
    BKBK
    Community Expert
    Community Expert
    Feb 14, 2017 2:05 PM UTC

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

    Translate