User Guide Cancel

CreateDate

 

Description

Creates a date/time object.

Returns

A date/time value.

Category

Date and time functions

Function syntax

CreateDate(year, month, day)
CreateDate(year, month, day)
CreateDate(year, month, day)

See also

CreateDateTimeCreateODBCDateTimeEvaluation and type conversion issues in Data type conversion in the Developing ColdFusion Applications

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

<cfscript>
year = 2018;
month = 11;
day = 02;
myDate=CreateDate(year,month,day)
writeOutput("The date is: " & myDate);
</cfscript>
<cfscript> year = 2018; month = 11; day = 02; myDate=CreateDate(year,month,day) writeOutput("The date is: " & myDate); </cfscript>
<cfscript>
    year = 2018;
    month = 11;
    day = 02;
    myDate=CreateDate(year,month,day)
    writeOutput("The date is: " & myDate);
</cfscript>

Output

The date is: {ts '2018-11-02 00:00:00'}

Get help faster and easier

New user?