Date conversion

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
snt_ds
Premium Member
Premium Member
Posts: 280
Joined: Wed Oct 18, 2006 11:53 am
Location: Pune, India

Date conversion

Post by snt_ds »

I am having Date as "MMDDYY" format.
I have to convert this one as "YYMMDD" and also concatenate '20' to year.
Please send me the solution for this.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

What have you tried so far? Did you look at StringToDate() function?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

You need to concatenate 20 first and then use string to date function. Something like StringToDate(Col[1,4] : 20 : Col[5,2],"%mm%dd%yyyy).
Coll[1,4] gets u 4 characters from the 1st character. and Col[5,2] gets 2 characters from 5th characters. Not sure whether the count starts from 0 or 1. Try it out and let us know.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

No you don't. Just specify the 20 in the data format string. There are examples in the manuals and on-line help.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply