convert string YYYYMM to date format

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
Aggie99
Participant
Posts: 54
Joined: Thu Sep 04, 2008 6:54 pm

convert string YYYYMM to date format

Post by Aggie99 »

I have a string "201009" which is YYYYMM format.

I need to convert it to two different formats:

Sept, 2010 and September, 2010 to be used in report titles.


Can someone show me how in the Transformer stage ?

thanks!
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

3 stage variables:

Code: Select all

svYearValue  In.DateString[1,4]
svMonthValueShort  FIELD('Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec',',',In.DateString[5,2])
svMonthValueLong  FIELD('January,February,March,April,May,June,July,August,September,October,November,December',',',In.DateString[5,2])
Then construct your output string using your required format(s) and the 3 stage variables, i.e. "svMonthValueShort:', ':svYearValue"
Aggie99
Participant
Posts: 54
Joined: Thu Sep 04, 2008 6:54 pm

Post by Aggie99 »

thank you.
Post Reply