CreateODBCDateTime

Returns a date/time object in ODBC timestamp format.

See also CreateDateTime, CreateODBCDate, CreateODBCTime, and Now.

Syntax

CreateODBCDateTime(date)
date

Date/time object in the period from 100 AD to 9999 AD.

Usage

When passing a date/time value as a string, make sure it is enclosed in quotes. Otherwise, it is interpreted as a number representation of a date/time object, returning undesired results.

Examples

<!---------------------------------------------------------
This example shows how to use CreateDate, CreateDateTime, and 
createODBCDateTime 
----------------------------------------------------------->
<HTML>
<HEAD>
<TITLE>
CreateODBCDateTime Example
</TITLE>
</HEAD>

<BODY bgcolor=silver>
<H3>CreateODBCDateTime Example</H3>
<CFIF IsDefined("FORM.year")>
Your date value, presented using different CF date functions:
<CFSET yourDate=CreateDateTime(FORM.year, FORM.month, FORM.day, 
    FORM.hour, FORM.minute, FORM.second)>
<CFOUTPUT>
<UL>
    <LI>Built with CreateDate:
      #CreateDate(FORM.year, FORM.month, FORM.day)#
    <LI>Built with CreateDateTime:
       #DateFormat(CreateDateTime(FORM.year, FORM.month, FORM.day,
            FORM.hour, FORM.minute, FORM.second))#
    <LI>Built with CreateODBCDate: #CreateODBCDate(yourDate)#
    <LI>Built with CreateODBCDateTime: #CreateODBCDateTime(yourDate)#
</UL>

<P>The same value can be formatted with dateFormat:
<UL>
    <LI>Built with CreateDate:
       #DateFormat(CreateDate
         (FORM.year, FORM.month, FORM.day), "mmm-dd-yyyy")#
    <LI>Built with CreateDateTime:
        #DateFormat(CreateDateTime
          (FORM.year, FORM.month, FORM.day, FORM.hour, FORM.minute,
            FORM.second))#
    <LI>Built with CreateODBCDate:
       #DateFormat(CreateODBCDate(yourDate), "mmmm d, yyyy")#
    <LI>Built with CreateODBCDateTime:
       #DateFormat(CreateODBCDateTime(yourDate), "d/m/yy")#
</UL>
</CFOUTPUT>
</CFIF>

<FORM ACTION="createodbcdatetime.cfm" METHOD="POST">
<!----------------------------------------------------------------------
The following hidden fields provide server-side validation of required 
fields and ensures that the data type is numeric.
----------------------------------------------------------------------->
<INPUT TYPE="hidden" NAME="year_Required">
<INPUT TYPE="hidden" NAME="month_Required">
<INPUT TYPE="hidden" NAME="day_Required">
<INPUT TYPE="hidden" NAME="hour_Required">
<INPUT TYPE="hidden" NAME="minute_Required">
<INPUT TYPE="hidden" NAME="second_Required">
<INPUT TYPE="hidden" NAME="month_Range" Value="Min=1 Max=12">
<INPUT TYPE="hidden" NAME="day_Range" Value="Min=1 Max=31">
<INPUT TYPE="hidden" NAME="hour_Range" Value="Min=1 Max=24">
<INPUT TYPE="hidden" NAME="minute_Range" Value="Min=1 Max=60">
<INPUT TYPE="hidden" NAME="second_Range" Value="Min=0 Max=60">

<P>Please enter the year, month and day in integer FORMat for 
the date value you would like to view:
<PRE>
Year    <INPUT TYPE="Text" NAME="year" VALUE="1999">
Month    <INPUT TYPE="Text" NAME="month" VALUE="6">
Day    <INPUT TYPE="Text" NAME="day" VALUE="8">
Hour    <INPUT TYPE="Text" NAME="hour" VALUE="16">
Minute    <INPUT TYPE="Text" NAME="minute" VALUE="12">
Second    <INPUT TYPE="Text" NAME="second" VALUE="0">
</PRE>
<P><INPUT TYPE="Submit" NAME=""> <INPUT TYPE="RESET">

</FORM>
</BODY>
</HTML>