Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date formatting input text box 1

Status
Not open for further replies.

JohnShell

Technical User
Aug 29, 2003
35
0
0
US
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
 
Did you try type="datefield" for your cfinput tag in conjunction with the mask attribute?

-Andy
 
Andy,

Thank you for the suggestion. Actually I succeeded this way:
In my SQL Select statement I "converted" the data thusly,

convert(varchar(10),startdate, 101) as BeginDate,
convert(varchar(10),stopdate, 101) as EndDate,
TypeHrs as TypeofHours,
NoOfHours as NumberHrsRequested,
projects as Project,
justification as Justification,
convert(varchar(10), RCbeginDate, 101) as RCBDate,

In in cfgrid I removed the type and mask attributes so that the data from the query would not be re-converted. So now the data that I bind to the input text boxes displays as 03/10/2011.
Again - thank you for responding. JS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top