In source there is a char field with this format yyyy-mm-dd.I need to convert this into date with this "mm/dd/yy" format.
I am using the function Stringtodate(input_col,"%mm/%dd/%yy").
The job is getting aborted with the error "Data string '1972-09-' does not match format '%mm/%dd/%yy': "
problem in stringtodate conversion
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You misunderstand. If you need to convert a string to a date, then you specify the date format of the string (not of the desired date).
Indeed, you never specify the format of a date - a date is a binary data type in DataStage parallel jobs.
So ask yourself, do you want a date coming out of this, or a string in some particular format? Once you have that answer, please post again.
Indeed, you never specify the format of a date - a date is a binary data type in DataStage parallel jobs.
So ask yourself, do you want a date coming out of this, or a string in some particular format? Once you have that answer, please post again.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
You can only do it if the target is Char or VarChar. In a transformer use substring to format the output. A derivation like should work.
Code: Select all
In.DateCol[6,2] : "/" : In.DateCol[9,2] : "/" : In.DateCol[3,2]