ColdFusion Programming/dates
Tools
General
Sister projects
In other projects
Coldfusion can handle the creation, modification, display, and usage of dates.
In order to set a date use the cfset function.
<cfset mydate = '12/3/2006'>
The basic display of a date is simply to output it.
<cfoutput>#mydate#</cfoutput>
This would display: 12/3/2006
There is function that allows you to easily convert a date into another format.
<cfoutput>#dateformat(mydate, 'yyyy/mm/dd')#</cfoutput>
This would display: 2006/12/3
The options to be used here are:
The options can be separated by - / , or space to create the format that you want.
If we want to add 5 days to today we would use this function.
<cfset todayplus5 = dateadd('d', 5, now())>The options for dateadd are: