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.
String to Date
Moderators: chulett, rschirm, roy
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.
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
"You can never have too many knives" -- Logan Nine Fingers
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.
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
"You can never have too many knives" -- Logan Nine Fingers