Skip to main content
Known Participant
September 22, 2011
Question

cfqueryparam

  • September 22, 2011
  • 1 reply
  • 606 views

Hi,

added_date is the smalldatime filed. 



(convert(varchar, added_date,102) >=  <cfqueryparam cfsqltype="cf_sql_date" value ="#dateformat(CreateODBCDatetime(form.startDate), "yyyy.mm.dd")#  />)

but the parameter is always show {ts '2008-09-13 00:00:00'} instead of 2008.09.13 since i already specify that format?, and also, how can I get rid of 00:00:00 ?

thanks

Amy

This topic has been closed for replies.

1 reply

Owainnorth
Inspiring
September 22, 2011

There is no need to "get rid of it", it's simply ColdFusion's representation of a date that has no time part.

Inspiring
September 22, 2011

but the parameter is always show {ts '2008-09-13 00:00:00'}

That is because you are using type cf_sql_date. So CF converts your formatted date string ie "2008.09.13" right back into a date object ie "{ts '2008-09-13 00:00:00'}" before it sends your statement to the database.

However, if your goal is to find all records with a date of 09/13/2008, you do not need any of the formatting. Just pass the value as a date object:

      ie   WHERE added_date >=  <cfqueryparam cfsqltype="cf_sql_date" value="#form.startDate#"  />

Message was edited by: -==cfSearching==-