Singleton
caplin.element.formatter

DateFormatter

Formats a date value by converting it from a specified input format to a new output format.

DateFormatter is typically used in the XML Renderer Framework, but can be invoked programmatically as in the following examples which evaluate to '09-Sep-2001 01:46:40' and '2001Sep09' respectively:

caplin.element.formatter.DateFormatter.format(1e12, {inputFormat:'U'})
caplin.element.formatter.DateFormatter.format(1e12, {inputFormat:'U', outputFormat:'YMd'})

See caplin.element.parser.DateParser for the complementary parser.

Constructor Summary

Attributes Name and Description
caplin.element.formatter.DateFormatter()

Method Summary

Attributes Name and Description
String format(Variant vValue, Map mAttributes)

Formats a date by converting it from a specified input format to a new output format.

Constructor Detail

caplin.element.formatter.DateFormatter()

Method Detail

String format(Variant vValue, Map mAttributes)

Formats a date by converting it from a specified input format to a new output format.

Attribute Options:

Option Description
inputFormat format of the input date, expressed with Moment.js format tokens (defaults to DD-MM-YYYY HH:mm:ss).
outputFormat format of the output date, expressed with Moment.js format tokens (defaults to DD-MM-YYYY HH:mm:ss).
adjustForTimezone boolean value representing whether the formatter should adjust the date according to the client's timezone

Parameters
Variant vValue the input date (String or Date type).
Map mAttributes the map of attributes.
Returns
the output date.