Skip to main content
Participating Frequently
March 1, 2011
Answered

Date formatting input text box

  • March 1, 2011
  • 1 reply
  • 616 views

Hi,

Using CF9 and MS SQL Server 2008. Have a form with JQuery calendar for user date insert. Data submitted onto SQL Srvr database "datetime" column.

Have another form with cfgrid (format is html and selectmode is row) and select statement to populate data from SQL Srvr. Using mask in cfgrid for date - eg

<cfgridcolumn name="BeginDate" header="Begin Date" display="no" headerfontsize="14px" width="90" mask="m/d/y" type="date"/>

The date in the grid displays as directed by the mask - 03/01/11. Have input text boxes on form bound to cfgrid - eg

<cfinput type="text" name="BeginDate" bind="{reqInfo.BeginDate}" readonly="true" width="100px" >

The date displayed in the text box is Thu Feb 24 00:00:00 EST 2011.

How can I get the input text boxes to display the date as m/d/y - like 03/01/11?

I have tried mask for the input text box - did not work. Tried  convert(varchar,BeginDate,101) as BeginDate

which also did not work. Any suggestions?

Thank you - JS

    This topic has been closed for replies.
    Correct answer Dan_Bracuk

    Change the type from date to string.  Continue to use the convert function, which does indeed, return a string.

    1 reply

    Dan_BracukCorrect answer
    Inspiring
    March 2, 2011

    Change the type from date to string.  Continue to use the convert function, which does indeed, return a string.

    Participating Frequently
    March 2, 2011

    I did what you recommended. However, I did not remove "mask" and "type" from my cfgrid coding. This, of course, caused the string to be returned to a date. Once I removed those two attributes the coding worked perfectly. Thank you.