Using the DateFormat Function

Use the DateFormat( ) function to display dates in a variety of ways. Its syntax is:

DateFormat(DateValue [, mask ])

DateFormat function usage examples

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>
Note To format dates for display:
  1. Return to the page that you're building.
  2. Format the StartDate query data using the DateFormat() function within the existing TD block:
  3. #DateFormat(StartDate)#
    
  4. Save the file.
  5. View the page in a browser.
  6. 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 Note:The navigation links will not work at this time.