Sunday, April 28, 2013

Date Transformations in datastage

DataStage provides a number of format strings that can be used to convert dates to strings and vice-versa. In the following examples, we use a DATE variable (date_value) that contains a value of "2000-02-29".
Description Syntax Result
Convert date to string DateToString(date_value,"%dd-%mm-%yyyy") 29-02-2000
Get short month name DateToString(date_value,"%mmm") Feb
Get long month name DateToString(date_value,"%mmmm") February
Get short weekday name DateToString(date_value,"%eee") Tue
Get long weekday name DateToString(date_value,"%eeee") Tuesday
Note that although the documentation mentions the "%eee" and "%eeee" format strings , they don't seem to work in isolation. I've had success with a format such as "%eee, %yyyy-%mm-%dd" but if I use "%eee" in isolation, I get the following error.
Transformer_2,0: Caught exception from runLocally(): APT_ParseError: Parsing pa rameters "%eee" for conversion "string=string_from_date[%yyyy-%mm-%dd](date)": APT_Conversion_String_Date: Invalid Format [%eee] used for string_from_date type conversion.

0 comments:

Post a Comment

Please Post your Comments..!