Whatever message this page gives is out now! Go check it out!
CreateDateTime(year, month, day, hour, minute, second, millisecond)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 |
hour | Integer in the range 0 - 23 |
minute | Integer in the range 0 - 59 |
second | Integer in the range 0 - 59 |
| millisecond | Integer in the range 0-999 |
CreateDateTime(year)CreateDateTime(year, month)CreateDateTime(year, month, day)CreateDateTime(year, month, day, hour)CreateDateTime(year, month, day, hour, minute)CreateDateTime(year, month, day, hour, minute, second)CreateDateTime(year, month, day, hour, minute, second, millisecond)Parameter | Default value |
Month | 1 |
Day | 1 |
Hour | 0 |
Minute | 0 |
Second | 0 |
<cfscript>
// Create date time object and display it
WriteOutput(CreateDateTime(2016,2,16,16,45,34) & " | "); // Create object for specified time
WriteOutput(#now()#); // Create object for now()
</cfscript><cfscript>
// In ColdFusion (2016 release), you can use the CreateDateTime in the following ways
WriteOutput(CreateDateTime(2016) & " | ");
WriteOutput(CreateDateTime(2016,6) & " | ");
WriteOutput(CreateDateTime(2016,6,10) & " | ");
WriteOutput(CreateDateTime(2016,6,10,17) & " | ");
WriteOutput(CreateDateTime(2016,6,10,17,45) & " | ");
WriteOutput(CreateDateTime(2016,6,10,17,45,38));
</cfscript><cfscript>
year = 2018;
month = 11;
day = 02;
hour = 1;
minute= 09;
second= 46;
myDate=CreateDateTime(year,month,day,hour,minute,second)
writeOutput("The date and time is: " & myDate);
</cfscript><cfscript>
myVar = createDateTime(2022,9,15,1,32,59,999);
writeOutput(myVar & "<br/>");
writeOutput("From millisecond(DateTime)" & "<br/>")
writeOutput(#millisecond(myVar)#);
writeOutput("<br/>")
writeOutput("From millisecond(DateTime)" & "<br/>")
writeOutput(#myVar.millisecond()#);
</cfscript>