DateToString() Invalid Format [%mmmm]

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
MrBlack
Participant
Posts: 125
Joined: Wed Aug 08, 2012 8:57 am

DateToString() Invalid Format [%mmmm]

Post by MrBlack »

Can someone help tell me what I'm doing wrong? My data is comes in in the following format YYMM and I'm trying to get the long month name.

Code: Select all

Sample Data as Integer
---------------------------
1501
1502
1503
So to translate the data this how the dates would read:

Code: Select all

Real Dates
------------
2015-01-01
2015-02-01
2015-03-01
First I declare a stage variable to get the integer into a date datatype

Code: Select all

WaveDt = DateFromComponents(YearFromDate(CurrentDate())[1,2] : DSLink13.WAVE[1,2],DSLink13.WAVE[3,2],"01")
Then the part I'm struggling with is getting the long month name:

Code: Select all

DateToString(WaveDt,"%mmmm")
But then I get this error:

Code: Select all

APT_CombinedOperatorController,0: Caught exception from runLocally(): APT_ParseError: Parsing parameters "%mmmm" for conversion "string=string_from_date[%yyyy-%mm-%dd](date)": APT_Conversion_String_Date: Invalid Format [%mmmm] used for string_from_date type conversion.
I verified the data format with IBM so I'm not sure why I'm getting this error.
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

Scroll down your doc link a little further, to Table 2. Format tag restrictions.

It says that "When some tags are used the format string requires that other tags are present too, as indicated in the 'requires' column."

The month tags cannot be used by themselves; it requires a year tag to be present also.

Why is a year tag also required? I have no idea, but it works. Then you would just need to strip off the year from the result.
Choose a job you love, and you will never have to work a day in your life. - Confucius
Post Reply