[thelist] SQL: Inserting Time & Date syntax?

Frank framar at interlog.com
Mon Nov 27 04:30:00 CST 2000


I'm having problems figuring out the syntax for inserting time and date into
Access2k from CF. Here's the scenario: The user enters data into a form, date
formatted as 11/12/2000 or Nov 12, 2000 it goes in fine. Same with inserting
8:00am.

If the user doesn't enter time or date, I want to make sure there's a default to
prevent an error, so in my insert statement I have

<cfif EventStartDate NEQ"">'#Trim(EventStartDate)#'
<cfelse>'#CreateODBCDate(Now())#'
</cfif>,

<cfif EventStartTime NEQ "">'#Trim(EventStartTime)#'
<cfelse>#CreateODBCTime('12:00:01')#
</cfif>,

I've tried inserting time and dates as strings:
    "11/11/2000"
    '11/11/2000'
    'Nov 11 2000'
    'November 11 2000'
    etc...

I want to insert today as the default date and 12:00:01 as the default time.

Questions: 
    What is the proper syntax for inserting a time and date?
    Why does it enter correctly from a form (get or post) but not directly?


Mucho Gracias!

Frank Marion                      Loofah Communications
frank at loofahcom.com               http://www.loofahcom.com




More information about the thelist mailing list