CreateDate |
Description
Creates a date/time object.
Returns
A date/time value.
Category
Date and time functions
Function syntax
    CreateDate(year, month, day)
See also
CreateDateTime, CreateODBCDate
Parameters
Parameter | Description
year | Integer in the range 0-9999. Integers in the range 0-29 are converted to 2000-
| 2029. Integers in the range 30-99 are converted to 1930-1999. You cannot
| specify dates before AD 100.
month | Integer in the range 1 (January) - 12 (December)
day | Integer in the range 1 - 31
Usage
CreateDate is a subset of CreateDateTime.
The time in the returned object is set to 00:00:00.
Example
    <h3>CreateDate Example</h3>
    <CFIF IsDefined("form.year")>
    <p>Your date value, generated with CreateDate:
    <CFSET yourDate = CreateDate(form.year, form.month, form.day)>
    <cfoutput>
    <ul>
       <li>Formatted with CreateDate: #CreateDate(form.year, form.month, form.day)#
       <li>Formatted with CreateDateTime: #CreateDateTime(form.year, form.month,
    form.day, 12,13,0)#
       <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, 12,13,0))#
       <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="createdate.cfm" METHOD="POST">
    <p>Enter the 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" VALIDATE="integer"
          REQUIRED="Yes">
    Day   <CFINPUT TYPE="Text" NAME="day" VALUE="8" VALIDATE="integer"
          REQUIRED="Yes">
    </PRE>
    <p><INPUT TYPE="Submit" NAME=""> <INPUT TYPE="RESET">
    </cfform>

year |
Integer in the range 0-9999. Integers in the range 0-29 are converted to 2000-2029. Integers in the range 30-99 are converted to 1930-1999. You cannot specify dates before AD 100.

month |
Integer in the range 1 (January) - 12 (December)

day |
Integer in the range 1 - 31