Returns a valid date/time object.
CreateDate(year, month, day)
CreateDateTime,
CreateODBCDate
CreateDate
is a subset of CreateDateTime.
Time in the returned object is set to 00:00:00.
<!--------------------------------------------------------- This example shows how to use CreateDate, CreateDateTime, and createODBCdate -----------------------------------------------------------> <html> <head> <title> CreateDate Example</title> </head> <basefont face = "Arial, Helvetica" size = 2> <body bgcolor = "#FFFFD5"> <H3>CreateDate Example</H3> <cfif IsDefined("FORM.year")> Your date value, presented using different CF date functions: <cfset yourDate = CreateDate(FORM.year, FORM.month, FORM.day)> <cfoutput> <UL> <LI>Built with CreateDate: #CreateDate(FORM.year, FORM.month, FORM.day)# <LI>Built with CreateDateTime: #CreateDateTime(FORM.year, FORM.month, FORM.day, 12,13,0)# <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, 12,13,0))# <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 = "createdate.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" 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> </body> </html>