User Guide
CreateODBCDateTime 537
CreateODBCDateTime
Description
Creates an ODBC date-time object.
Returns
A date-time object, in ODBC timestamp format.
Category
Date and time functions
Function syntax
CreateODBCDateTime(date)
See also
CreateDateTime
, CreateODBCDate, CreateODBCTime, Now; “Evaluation and type conversion
issues” in Chapter 3, “Using ColdFusion Variables,” in ColdFusion MX Developer’s Guide
Parameters
Usage
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.
Example
<!--- This example shows how to use CreateDate, CreateDateTime,
CreateODBCDate, and CreateODBCDateTime --->
<h3>CreateODBCDateTime Example</h3>
<cfif IsDefined("form.year")>
Your date value, generated using CreateDateTime:
<cfset yourDate = CreateDateTime (form.year, form.month, form.day,
form.hour,form.minute, form.second)>
<cfoutput>
<ul>
<li>Formatted with CreateDate: #CreateDate(form.year, form.month,form.day)#
<li>Formatted with CreateDateTime: #CreateDateTime(form.year,form.month,
form.day,form.hour,form.minute,form.second)#
<li>Formatted with CreateODBCDate: #CreateODBCDate(yourDate)#
<li>Formatted with CreateODBCDateTime: #CreateODBCDateTime(yourDate)#
</ul>
<p>The same value can be formatted with DateFormat:
<ul>
<li>Formatted with CreateDate and DateFormat:
#DateFormat(CreateDate(form.year,form.month,form.day), "mmm-dd-yyyy")#
<li>Formatted with CreateDateTime and DateFormat:
#DateFormat(CreateDateTime(form.year,form.month,form.day,
form.hour,form.minute,form.second))#
Parameter Description
date Date-time object in the range 100 AD–9999 AD.