formatDateWithPattern

Reformats a date/time to a specified date/time pattern.

Type and Usage

Parameters

Takes two parameters:

  • The first parameter is a date string used by the Content Server, or a date object created with the parseDate or dateCurrent functions.

  • The second parameter is the date/time pattern, such as MM/dd/yyyy.

    The capital letter Z denotes the use of a UTC time zone for the entry. The lowercase zzzz denotes the time offset (HHMM) from the UTC time, preceded by a plus (+) or minus (-) sign to indicate the offset.

Output

  • Returns the date/time in the format specified by the pattern parameter.

  • Returns null if the parameter cannot be evaluated.

Example

Displays Wed, 5 Jul 2006 12:08:56 -0700:

<$formatDateWithPattern(dateCurrent(),"EEE, d MMM yyyy HH:mm:ss zzzz")$>

Displays 2006-07-05 14:30:33Z:

<$formatDateWithPattern(dateCurrent(),"yyyy-MM-dd HH:mm:ssZ")$>