formatDate

Reformats a date/time to the default date/time format.

Database-formatted dates cannot be evaluated (for example, 2001-06-15).

Long-formatted dates cannot be evaluated (for example, June 15, 2001).

Type and Usage

Parameters

The only parameter is a string that specifies a date/time.

Output

  • Returns the date/time in the format used by dateCurrent (for example, 6/15/01 1:55 PM).

  • Returns null if the parameter cannot be evaluated.

  • If a time is not provided, returns a default time of 12:00 AM.

Example

The following example formats the date and time and displays it as 12/14/99 2:00 PM:

<$formatDate("12/14/1999 02:00 PM")$>

The following example formats the date, assigns the default time, and displays it as 9/15/03 12:00 AM:

<$formatDate("09/15/2003")$>

The following script formats and displays a specified date and time. Line one evaluates an alternate date and time format and assigns it to a custom variable. Line two displays this date to a user.

<$my_customDateTime = formatDate("06/14/2004 15:05:34")$>
Final Approval: <$my_customDateTime$>

Output:

Final Approval: 6/14/04 3:05 PM