<html>
<head>
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>CREATEODBCDATETIME</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="Description">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">CREATEODBCDATETIME</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Description</span>
<p>
Creates an ODBC date-time object.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Returns</span>
<p>
A date-time object, in ODBC timestamp format.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Category</span>
<p>
Date and time functions
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Function syntax</span><pre>CreateODBCDateTime(date)
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">See also</span>
<p>
CreateDateTime, CreateODBCDate, CreateODBCTime, Now; "Evaluation and type conversion issues" in Chapter&#160;3, "Using ColdFusion Variables," in ColdFusion MX Developer's Guide
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Parameters</span>
<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Usage</span>
<p>
When passing a date-time value as a string, you must enclose it in quotation marks. Otherwise, it is interpreted as a number representation of a date-time object.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Example</span><pre>&lt;!--- This example shows how to use CreateDate, CreateDateTime, 
CreateODBCDate, and CreateODBCDateTime ---&gt;
&lt;h3&gt;CreateODBCDateTime Example&lt;/h3&gt;

&lt;CFIF IsDefined(&quot;form.year&quot;)&gt;
Your date value, generated using CreateDateTime:
&lt;CFSET yourDate = CreateDateTime (form.year, form.month, form.day,
form.hour,form.minute, form.second)&gt;
&lt;cfoutput&gt;
&lt;ul&gt;
   &lt;li&gt;Formatted with CreateDate: #CreateDate(form.year, form.month,form.day)#
   &lt;li&gt;Formatted with CreateDateTime: #CreateDateTime(form.year,form.month,
      form.day,form.hour,form.minute,form.second)#
   &lt;li&gt;Formatted with CreateODBCDate: #CreateODBCDate(yourDate)#
   &lt;li&gt;Formatted with CreateODBCDateTime: #CreateODBCDateTime(yourDate)#
&lt;/ul&gt;
&lt;p&gt;The same value can be formatted with DateFormat:
&lt;ul&gt;
   &lt;li&gt;Formatted with CreateDate and DateFormat: 
      #DateFormat(CreateDate(form.year,form.month,form.day), &quot;mmm-dd-yyyy&quot;)#
   &lt;li&gt;Formatted with CreateDateTime and DateFormat: 
      #DateFormat(CreateDateTime(form.year,form.month,form.day, 
      form.hour,form.minute,form.second))#
   &lt;li&gt;Formatted with CreateODBCDate and DateFormat: 
      #DateFormat(CreateODBCDate(yourDate), &quot;mmmm d, yyyy&quot;)#
   &lt;li&gt;Formatted with CreateODBCDateTime and DateFormat: 
      #DateFormat(CreateODBCDateTime(yourDate), &quot;d/m/yy&quot;)#
&lt;/ul&gt;
&lt;/cfoutput&gt;
&lt;/CFIF&gt;
&lt;CFFORM ACTION=&quot;createodbcdatetime.cfm&quot; METHOD=&quot;POST&quot;&gt;
&lt;p&gt;Enter a year, month and day, as integers:
&lt;PRE&gt;

Year      &lt;CFINPUT 
         TYPE=&quot;Text&quot;  NAME=&quot;year&quot; VALUE=&quot;1998&quot; VALIDATE=&quot;integer&quot; 
REQUIRED=&quot;Yes&quot;&gt;

Month      &lt;CFINPUT 
         TYPE=&quot;Text&quot; NAME=&quot;month&quot;  VALUE=&quot;6&quot;  RANGE=&quot;1,12&quot; 
         MESSAGE=&quot;Enter a month (1-12)&quot; VALIDATE=&quot;integer&quot; REQUIRED=&quot;Yes&quot;&gt;

Day      &lt;CFINPUT TYPE=&quot;Text&quot; NAME=&quot;day&quot; VALUE=&quot;8&quot; RANGE=&quot;1,31&quot; 
         MESSAGE=&quot;Enter a day of the month (1-31)&quot; VALIDATE=&quot;integer&quot; 
REQUIRED=&quot;Yes&quot;&gt;

Hour      &lt;CFINPUT TYPE=&quot;Text&quot; NAME=&quot;hour&quot; VALUE=&quot;16&quot; RANGE=&quot;0,23&quot; 
         MESSAGE=&quot;You must enter an hour (0-23)&quot; VALIDATE=&quot;integer&quot; 
REQUIRED=&quot;Yes&quot;&gt;
         
Minute      &lt;CFINPUT TYPE=&quot;Text&quot; NAME=&quot;minute&quot; VALUE=&quot;12&quot; RANGE=&quot;0,59&quot; 
         MESSAGE=&quot;You must enter a minute value (0-59)&quot; VALIDATE=&quot;integer&quot; 
REQUIRED=&quot;Yes&quot;&gt;
         
Second      &lt;CFINPUT TYPE=&quot;Text&quot; NAME=&quot;second&quot; VALUE=&quot;0&quot; RANGE=&quot;0,59&quot; 
         MESSAGE=&quot;You must enter a seconds value (0-59)&quot; VALIDATE=&quot;integer&quot; 
REQUIRED=&quot;Yes&quot;&gt;
&lt;/PRE&gt;
&lt;p&gt;&lt;INPUT TYPE=&quot;Submit&quot; NAME=&quot;&quot;&gt; &lt;INPUT TYPE=&quot;RESET&quot;&gt;
&lt;/cfform&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="DATE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">DATE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>


<p>Date-time object in the range 100 AD-9999 AD. </p>

  </td>
  </tr>
  </table>
</div>

  </body>
</html>
