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

CreateODBCDate and cfqueryparam with cf_sql_date

New Here ,
Jan 08, 2009 Jan 08, 2009

Copy link to clipboard

Copied

Hi all.

I've got a form that's accepting the following date formats (YYYY-MM-DD and MM-DD-YYYY).

Just wondering if it's even necessary to use the CreateODBDate when I'm passing in the dates in my <cfquery> using a queryparam with a type of cf_sql_date?

From what I understand cf_sql_date will recognize either of the two formats and properly create the ODBC date the way it's supposed to, but I can't find any resources that says this. Anyone know this for sure or not, and maybe have a reference I can point my team in the right direction?

Thanks.
TOPICS
Advanced techniques

Views

480

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 ,
Jan 08, 2009 Jan 08, 2009

Copy link to clipboard

Copied

Unless there is a known difference in how the two parse date strings, I would say no. Both parse a string and return a properly formatted date/time object. I strongly suspect they both use the same parsing method behind the scenes anyway.

As an aside, MM-DD-YYYY can be interpreted multiple ways. But most likely both CreateODBCDate and cfqueryparam will interpret the value the same way.. for right or wrong 😉

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
LEGEND ,
Jan 08, 2009 Jan 08, 2009

Copy link to clipboard

Copied

LATEST
While it might work, I've personally stopped doing things like you suggest. I'd use createdate to convert those strings to date objects. One of the reasons is the ambiguity mentioned 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