View comments | RSS feed
Contents > CFML Reference > ColdFusion Functions > CreateODBCDateTime PreviousNext

CreateODBCDateTime

Creates an ODBC date-time object.

A date/time object, in ODBC timestamp format.

Date and time functions

CreateODBCDateTime(date)

CreateDateTime, CreateODBCDate, CreateODBCTime, Now

Parameter

Description

date

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

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.

<!--- 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))# <li>Formatted with CreateODBCDate and DateFormat: #DateFormat(CreateODBCDate(yourDate), "mmmm d, yyyy")# <li>Formatted with CreateODBCDateTime and DateFormat: #DateFormat(CreateODBCDateTime(yourDate), "d/m/yy")# </ul> </cfoutput> </CFIF> <CFFORM ACTION="createodbcdatetime.cfm" METHOD="POST"> <p>Enter a year, month and day, as integers: <PRE> Year <CFINPUT TYPE="Text" NAME="year" VALUE="1998" VALIDATE="integer" REQUIRED="Yes"> Month <CFINPUT TYPE="Text" NAME="month" VALUE="6" RANGE="1,12" MESSAGE="Enter a month (1-12)" VALIDATE="integer" REQUIRED="Yes"> Day <CFINPUT TYPE="Text" NAME="day" VALUE="8" RANGE="1,31" MESSAGE="Enter a day of the month (1-31)" VALIDATE="integer" REQUIRED="Yes"> Hour <CFINPUT TYPE="Text" NAME="hour" VALUE="16" RANGE="0,23" MESSAGE="You must enter an hour (0-23)" VALIDATE="integer" REQUIRED="Yes"> Minute <CFINPUT TYPE="Text" NAME="minute" VALUE="12" RANGE="0,59" MESSAGE="You must enter a minute value (0-59)" VALIDATE="integer" REQUIRED="Yes"> Second <CFINPUT TYPE="Text" NAME="second" VALUE="0" RANGE="0,59" MESSAGE="You must enter a seconds value (0-59)" VALIDATE="integer" REQUIRED="Yes"> </PRE> <p><INPUT TYPE="Submit" NAME=""> <INPUT TYPE="RESET"> </cfform>

Contents > CFML Reference > ColdFusion Functions > CreateODBCDateTime PreviousNext

ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


rev_robert said on Jun 21, 2004 at 6:55 AM :
In using the CreateODBCDateTime() function, there appears to be some inconsistency in it's behavior. If the date parameter supplied is of the form "Thu Apr 12004", the function appears to work fine unless the day of the week part begins with a 'T'. In describing the function, it would be very helpful to also have described all of the valid formats in which the date parameter can be supplied.

Thank you,
Robert
halL said on Jun 21, 2004 at 8:02 AM :
We have reported the problem indicated by rev_robert as Macromedia ColdFusion bug number 55962.
You can work around this problem by omitting the day of the week from the text string.
No screen name said on Dec 1, 2004 at 12:36 PM :
I have recently updated from coldfusion 4 to coldfusionMX and have also updated from Oracle 8.0.5 to 9.2.0. What I see is CreateODBCDateTime no longer works for my insert statements. I have a large code base that would have to be modified if I were to embark on a code fix. What I would like is to use different thin client drivers that make this work without changing any existing code.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functi50.htm