CreateODBCDate

Returns a date in ODBC date format.

See also CreateDate and CreateODBCDateTime.

Syntax

CreateODBCDate(date)
date

Date/time object in the period from 100 AD to 9999 AD. Years from 0 to 29 are interpreted as 21st century values. Years 30 to 99 are interpreted as 20th century values.

Examples

<!---------------------------------------------------------
This example shows how to use CreateDate, CreateDateTime, and 
createODBCdate 
----------------------------------------------------------->

<HTML>

<HEAD>
<TITLE>
CreateODBCDate Example
</TITLE>
</HEAD>

<basefont face="Arial, Helvetica" size=2>
<body  bgcolor="#FFFFD5">

<H3>CreateODBCDate 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")#
    <LI>Built with CreateDateTime:
        #DateFormat(CreateDateTime
          (FORM.year, FORM.month, FORM.day, FORM.hour,
            FORM.minute,FORM.second))#
    <LI>Built with CreateODBCDate:
       #DateFormat(CreateODBCDate(yourDate), "mmmm d, yyyy")#
    <LI>Built with CreateODBCDateTime:
       #DateFormat(CreateODBCDateTime(yourDate), "d/m/yy")#
</UL>
</CFOUTPUT>
</CFIF>

<CFFORM ACTION="createODBCdate.cfm" METHOD="POST">
<P>Please enter the year, month and day in integer format for 
the date value you would like to view:
<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="Please enter a month (1-12)" VALIDATE="integer"
    REQUIRED="Yes">
Day    <CFINPUT TYPE="Text" NAME="day" VALUE="8" RANGE="1,31"
  MESSAGE="Please 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 value for seconds (0-59)" 
    VALIDATE="integer" REQUIRED="Yes">
</PRE>
<P><INPUT TYPE="Submit" NAME=""> <INPUT TYPE="RESET">
</CFFORM>
</BODY>
</HTML> 

1