Hi,
I wanted to convert one varchar field into date field using the modify stage. My input field is in the dd-mm-yyyy format and I used the below specification in the modify stage.
in_col:date = date_from_string "%dd-%mm-%yyyy"(in_col)
But I am getting the below error while running the job.
main_program: Error parsing modify adapter: Expected ';' or end, got: "%dd-%mm-%yyyy""
Expected destination field selector, got: ")"; input:
Dt_of_extrcn:date = date_from_string "%dd-%mm-%yyyy"(Dt_of_extrcn)
;
Please help me to resolve this issue.
Thanks
Converting string to date in modify stage
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 28
- Joined: Mon Apr 20, 2009 11:27 pm
- Location: san antonio
Converting string to date in modify stage
Last edited by shukla_krishna on Mon Jun 15, 2009 6:34 am, edited 1 time in total.
Krishna Shukla
-
- Premium Member
- Posts: 28
- Joined: Mon Apr 20, 2009 11:27 pm
- Location: san antonio
Re: Converting string to date in modify stage
Thanks Sam. It works.
But my input data is in the format dd-mm-yyyy. Can I convert a string in the format dd-mm-yyyy to date field.
But my input data is in the format dd-mm-yyyy. Can I convert a string in the format dd-mm-yyyy to date field.
Krishna Shukla
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
What is your default date format string? It is is not "%dd-%mm-%yyyy" then you need to specify the date format string - inside square brackets - in the Specification in the Modify stage.
Note also that this will not work if your date is not precisely this format, for example 16/6/2009 or 16-6-2009 or 16/06/2009 will not work, but 16-06-2009 will.
Code: Select all
date_from_string[%dd-%mm-%yyyy](inputcolumn)
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.