NewDateFormatter

The NewDateFormatter function defines a date formatter. It returns an index for use in the ParseDate and FormatDate functions. The indices start at 0 and go up by one for each call to NewDateFormat. Date formatters are valid during execution of the process.

This is a TM1® TurboIntegrator function, valid only in TurboIntegrator processes.

Syntax

NewDateFormatter(Locale, <TimeZone>, <UseUNIXTime>, <FormatterStyle>, <FormatterType>, <TimeType>)

Arguments

Argument

Description

Locale

Locale used for parsing or formatting dates.

If an empty string is passed, then the operating system locale is used. Locales are specified in the format language[_territory][.variant]. For example, cs_CK is the Czech language and Czech Republic.

TimeZone

Timezone used for parsing or formatting dates.

Refer to http://en.wikipedia.org/wiki/List_of_tz_database_time_zones for a complete list of time zones.

If not specified, the time zone used is UTC ('Etc/UTC').

UseUNIXTime

If 'unix' is specified, then times are treated as milliseconds since January 1, 1970. Otherwise, they are treated in TM1 serial format.

Note that only dates later than January 1, 1970 can be processed even if TM1 serial format is used.

FormatterStyle

Controls the date format used when an empty pattern is specified to the FormatDate or ParseDate functions.

Valid values are 'full', 'long', 'medium' or 'short'.

The default is 'medium'.

FormatterType

Controls the type of format used when an empty pattern is specified to the FormatDate or ParseDate functions.

Valid values are 'time', 'date' or 'datetime'.

The default is 'date'.

Example

dfUNIX = NewDateFormatter('', 'Etc/UTC', 'unix');

dfStyleFullDateTime = NewDateFormatter('en_us', 'America/Toronto', 'serial', 'full', 'datetime');