ColdFusion 9.0 Resources |
CreateODBCDateTimeSee alsoCreateDateTime, CreateODBCDate, CreateODBCTime,Now; Evaluation and type conversion issues in the Developing ColdFusion Applications UsageWhen passing a date-time value as a string, 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: <cfet 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> |