1.3.11.8 Convert Date to String

The Convert Date to String transformer takes any number of DATE or DATEARRAY attributes, and converts them to a STRING or STRINGARRAY type respectively.

Use Convert Date to String when you want to treat the date as a text, for processing purposes. For example, in order to extract the day, month and year parts of a date to separate attributes for matching, you may want to convert the date to a String type, and then use Trim Characters to extract the different parts.

Note that the Date is converted to a String value with a standard international format for dates (dd-MMM-yyyy, for example, 25-Apr-2006).

The following table describes the configuration options:

Configuration Description

Inputs

Specify any number of Date or Date Array attributes that you want to convert to a String or String Array type.

Options

Specify the following options:

  • Output Format: the format of the date used to create the new String value. Specified as the entry of a date format. The output format expressed must conform to the standard Java 1.5 or Java 1.6 SimpleDateFormat API. Default value: dd-MMM-yyyy HH:mm:ss.

  • Time zone: sets the time zone to use for the output string value. The string will be produced by converting the supplied date to this time zone. The input date value does not have an associated time zone, as all dates are stored as UTC values. Default value is the Director Time Zone.

Outputs

Describes any data attribute or flag attribute outputs.

Data Attributes

For each attribute input, a new attribute is created in the following format:

  • [Attribute Name].DateToString: stores the result of the DATE to String conversion. Value is derived from the original attribute value, converted to a String type.

Flags

None.

The Convert Date to String transformer presents no summary statistics on its processing. In the Data view, each input attribute is shown with its new derived String type attribute to the right.

Output Filters

None.

Example

In this example, Convert Date to String is used to convert a DT_LAST_PAYMENT attribute to a String type. Note that in this example, the time element is stripped during the date conversion by deleting the time element (HH:mm:ss) from the Output Format.

DT_LAST_PAYMENT DT_LAST_PAYMENT.DateToString

11-Mar-2000 00:00:00

11-Mar-2000

16-Sep-2003 00:00:00

16-Sep-2003

15-Mar-2000 00:00:00

15-Mar-2000

05-Oct-2001 00:00:00

05-Oct-2001

{05-Oct-2001 00:00:00}{12-Apr-2000 00:00:00}

{05-Oct-2001}{12-Apr-2000}