createDateTime

Creates a date-time object.

createDateTime(year, month, day, hour, minute, second) → returns date

Argument Reference

year numeric
Required

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

month numeric
Required
Default: 1

Numeric month of the year (1-12).

day numeric
Required
Default: 1

Day of the month.

hour numeric
Required
Default: 0

Hour of the day in 24-hour notation (0-23).

minute numeric
Required
Default: 0

Minute within the hour.

second numeric
Required
Default: 0

Second within the minute.

millisecond numeric
Default: 0

CF 2021+ or Lucee 4.5+ Only

timezone numeric

Lucee 4.5+

Compatibility

ColdFusion:

Version 6+ Since CF2016+ month, day, hour, minute are second are optional

Examples
Sample code invoking the createDateTime function

<cfset yourDate = createDateTime("2015", "12", "09", "6", "20", "34")>
<cfdump var="#yourDate#" />     

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub