Use the DateFormat( ) function to display dates in a variety of ways. Its syntax is:
DateFormat(DateValue [, mask ])
When the DateValue is a fixed value, surround it with double quotes (" ) so that ColdFusion does not interpret it as a numeric value.
For example, a mask may describe dd/mm/yy or mm/dd/yy.
Surround the mask value with double quotes (" ) so that ColdFusion interprets it as a character string.
The code below formats the current system date on a North American site:
<CFOUTPUT>
#DateFormat(Now(),"DD/MM/YY")#
</CFOUTPUT>
The code below formats the StartDate column data that was returned from a query performed earlier on the same page:
<CFOUTPUT QUERY=EmpList>
#DateFormat(StartDate)#<BR>
</CFOUTPUT>
| To format dates for display: |
#DateFormat(StartDate)#
The StartDate is formatted for page display.
Click here to see how the page should look at this time.
Click here to see the code behind the scenes.
| Note: | The navigation links will not work at this time. |