OpenWGA 7.7 - TMLScript reference

WGA
Method :

format(object, formatPattern [, language])

On object WGA
Usage Creates a formatted date string from a Date object or a formatted number string from a Number object
Description

Use the same syntax for format patterns as known from WebTML attribute format.

For backward compatibility there still is a global function "format()" available whose use is discouraged since OpenWGA 5.3.

Parameters object (String):
Date or Number object

formatPattern (String):
Format pattern determining the output string format

language (String, optional):
A language string determining the language for language dependent formattings. Omit to let OpenWGA language behaviour choose the language.

Return value String representing the Date/Number in the specified format (String)
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
    portletevent
Examples Example using a Date:

return WGA.format(CREATED, "dd.MM.yyyy") // Returning a string like "24.12.2005"


Example using a number:

return WGA.format(1.2, "#,##0.000") // Returning a string like "1.200"