String to Date

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
eswar1
Participant
Posts: 10
Joined: Sat Jan 01, 2011 6:21 am

String to Date

Post by eswar1 »

my source sequencial file has three attributes.
one dd-mm-yyyy format
two:mmddyyyy format
three: yyyy/dd/mm format
I wants convert string to date format the above all attributs.
How to validate and convert from string to date.
Pls help me.
eswar
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:!: Split from this topic. When you have a problem or question, please start a new post rather than jumping on the end of someone else's conversation. That way we know what product and version you have and you have full control over the destiny of the post since you 'own' it. If you really feel that other post has value, add a link to it in yours much like I did above.

I've made assumptions about your environment (8.x,PX,UNIX), if any are incorrect please edit your post and change them appropriately. Thanks.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Now on to your question...

First tell us if you have these formats in different fields, meaning you know what format will be coming where, or if they are all mixed into a single source field. The former is pretty straight-forward while the latter will require you to identify the proper format to use in a series of if-then-else constructs... as one example of an approach.

Regardless, the solution is the same - the use of the StringToDate() function with a mask that matches the incoming date format so it knows how to convert it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply