Skip to main content
Participating Frequently
January 8, 2009
Question

CreateODBCDate and cfqueryparam with cf_sql_date

  • January 8, 2009
  • 2 replies
  • 523 views
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.
This topic has been closed for replies.

2 replies

Inspiring
January 9, 2009
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.
Inspiring
January 8, 2009
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 ;-)