Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
0

date and datetime types with cfqueryparam

Guest
Mar 30, 2011 Mar 30, 2011

How do you get a date and a datetime type into a table with cfqueryparam ?

For date  I have tried <cfqueryparam value=#createodbcdate(thedate)# cfsqltype="CF_SQL_DATE" maxlength="23" null="yes"> and got NULL in the table.

For time I tried <cfqueryparam value=#now()# cfsqltype="CF_SQL_TIME" maxlength="23" null="yes"> but the date part of the datetime value was 1970-01-01.

In the table, types for these columns are datetime.

TOPICS
Getting started
11.5K
Translate
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

correct answers 1 Correct answer

Valorous Hero , Mar 30, 2011 Mar 30, 2011

As the name implies, cf_sql_date only inserts the date. Any time value is truncated. To insert both date and time use cf_sql_timestamp.

For date  I have tried <cfqueryparam

value=#createodbcdate(thedate)# cfsqltype="CF_SQL_DATE"

maxlength="23" null="yes"> and got NULL in the table.

That is what null="yes" means. It instructs CF to ignore the "value" and insert a NULL instead. Only use it if that is the desired result.

Translate
Valorous Hero ,
Mar 30, 2011 Mar 30, 2011

As the name implies, cf_sql_date only inserts the date. Any time value is truncated. To insert both date and time use cf_sql_timestamp.

For date  I have tried <cfqueryparam

value=#createodbcdate(thedate)# cfsqltype="CF_SQL_DATE"

maxlength="23" null="yes"> and got NULL in the table.

That is what null="yes" means. It instructs CF to ignore the "value" and insert a NULL instead. Only use it if that is the desired result.

Translate
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
Guest
Mar 30, 2011 Mar 30, 2011
LATEST

Thank you. Hope no more questions for this.

Translate
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