Date convertion

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
subrat
Premium Member
Premium Member
Posts: 77
Joined: Tue Dec 11, 2007 5:54 am
Location: UK

Date convertion

Post by subrat »

Can anyone please through some light on converting DD/MM/YYYY format to YYYY-MM-DD format in PX?
braj
Participant
Posts: 17
Joined: Mon Dec 08, 2008 2:12 am

Re: Date convertion

Post by braj »

subrat wrote:Can anyone please through some light on converting DD/MM/YYYY format to YYYY-MM-DD format in PX?
You can use below format:
StringToDate(DATE_COL,"%dd-%mmm-%1980yy")

where 1980 is cut-off year. hence it will convert 03-MAY-99 to 1999-05-03 and 05-NOV-05 to 2005-11-05.

Hope this helps.

Thanks
Brajesh.
Braj
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The 1980 part is unneeded with a 4 digit year as is "mmm" with a 2 digit month. Are both of your examples strings? Or is one an actual Date? That changes the answer, but the StringToDate() and DateToString() functions are what you need to become familiar with.
-craig

"You can never have too many knives" -- Logan Nine Fingers
braj
Participant
Posts: 17
Joined: Mon Dec 08, 2008 2:12 am

Post by braj »

aah....I answered it for DD-MON-YY format...

for this format, simple thing is to use:

StringToDate(DATE_COL,"%dd/%mm/%yyyy")

Thanks
Brajesh.
Braj
Post Reply