2 Replies Latest reply on Sep 22, 2011 7:50 AM by -==cfSearching==-


    newcf Level 1



      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 ?





        • 1. Re: cfqueryparam
          Owain North Level 4

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

          • 2. Re: cfqueryparam
            -==cfSearching==- Level 4

            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==-