Inside Coldfusion MX

"-->

DateFormat (" date" [, " mask" ])

Description

Formats a date value. Supports dates in the U.S. date format. For international date support, use LSDateFormat. A mask is optional, and the default is dd-mmm-yy format. Use the following values for the mask:

  • d. Day of the month as digits (no leading zero for single digits).

  • dd. Day of the month as digits (leading zero for single digits).

  • ddd. Day of the week as a three-letter abbreviation.

  • dddd. Day of the week as its full name.

  • m. Month as digits (no leading zero for single digits).

  • mm. Month as digits (leading zero for single digits).

  • mmm. Month as a three-letter abbreviation.

  • mmmm. Month as its full name.

  • y. Year as last two digits (no leading zero for years less than 10).

  • yy. Year as last two digits (no leading zero for years less than 10).

  • yyyy. Year represented by four digits.

  • gg. Period/era string. Ignored, but reserved for future use.

Example

<cfset exampleDate = now()> <cfoutput> #DateFormat(exampleDate)# #DateFormat(exampleDate, "mm/dd/yyyy")# #DateFormat(exampleDate, "mmm-dd-yyyy")# #DateFormat(exampleDate, "mmmm d, yyyy")# #DateFormat(exampleDate, "d/m/yy")# </cfoutput>

Категории