User Guide
Chapter 2: ColdFusion Functions 307
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. Years from 0 to 29 are
interpreted as 21
st
century values. Years 30 to 99 are interpreted as 20
th
century
values.
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")#