How to create a date object in ColdFusion

CreateDate() - create a date object

CreateDate.cfm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CreateDate function example: how to create a date object</title>
</head>

<body>
<h2 style="color:hotpink">CreateDate Function Example</h2>

<cfset Year="1971">
<cfset Month="12">
<cfset Day="16">
<cfset CreatedDate=CreateDate(Year,Month,Day)>
<cfoutput>
<b>
Year: #Year#
<br />
Month: #Month#
<br />
Day: #Day#
<br /><br />
Created Date: #CreatedDate#
<br />
Created Date: #DateFormat(CreatedDate)#
</b>
</cfoutput>
</body>
</html>





More ColdFusion examples