• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cfqueryparam

New Here ,
Sep 22, 2011 Sep 22, 2011

Copy link to clipboard

Copied

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

TOPICS
Advanced techniques

Views

503

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 22, 2011 Sep 22, 2011

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Sep 22, 2011 Sep 22, 2011

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation