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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using DateFormat in CFSELECT

Status
Not open for further replies.

jmcg

Technical User
Jun 30, 2000
223
GB
I have a form which I wish to populate with various CFSELECTS. These are all includes to the main template so have variables in various options.
not sure if that is the problem but I am trying to get a CFSELECT list of date formated into the standard UK format of "mm dd yy". However when I try this I get error of value not being converted to a Date or trying other way I get filed not in the query.
The variables passed are:
jmQValue=CHECKDATE_1
jmQValueName=CHECKDATE
the query is then "CheckCHECKDATE_1"
Code:
<CFSELECT query="Check#jmQValue#" name="#jmQValue#" value="#DateFormat(jmQValueName)#"></CFSELECT>
have also tried
Code:
<CFSELECT query="Check#jmQValue#" name="#jmQValue#" value="#DateFormat(evaluate(jmQValueName))#"></CFSELECT>
If I just use:
Code:
<CFSELECT query="Check#jmQValue#" name="#jmQValue#" value="#jmQValueName#"></CFSELECT>
I get the correct output but in the Americanised format with time data as well.
Any help much appreciated.
 
mm dd yy the standard UK format of "mm dd yy"

I thought UK was dd mm yyyy? ie day of month first

Anyway, when using the "query" attribute you have to format your values before-hand (ie in your sql statement).

I don't know what db you're using. Check your docs for formatting functions

MS SQL - convert()
MySql - Date_Format()
Access - Try format() maybe?
...

 
dateformat takes a mask as well as the date.

Yes, but afaik you cannot use it on "value" or "display" of a cfselect that uses "query". You have to format the "value" or "display" values beforehand (ie in the sql query)
 
The SQL way was the one that worked, thanks cfStarlight.
The mask is not required in MX as it will go to the server default which is of course as you say dd mm yy, that was my typo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top