Page 1 of 1

StingtoDate

Posted: Wed Mar 11, 2009 12:55 pm
by devanars
I am getting this error while converting stringtodate. source is .csv file and datatype is varchar have to keep date in oracle target.
using the ds version 8.1

I am using the code: StringToDate(SRC.DATE,'%mm/%dd/%yyyy')
getting resulet like **************

APT_CombinedOperatorController,0: Data string '11/2/2007' does not match format '%mm/%dd/%yyyy': the value for tag %dd has fewer characters than expected.

any advise!

Posted: Wed Mar 11, 2009 1:05 pm
by ArndW
I had that issue a while back and had to use the length and an IF THEN ELSE clause with two different pictures for the date. I vaguely recall having seen someone post a format that accepts variable length date components but am not sure - I do know that it isn't documented.

Re: StingtoDate

Posted: Wed Mar 11, 2009 1:54 pm
by betterthanever
using this format would solve the issue

Code: Select all

StringToDate(SRC.DATE,'%m/%d/%yyyy')

Re: StingtoDate

Posted: Wed Mar 11, 2009 1:54 pm
by betterthanever
repost

Re: StingtoDate

Posted: Wed Mar 11, 2009 1:55 pm
by betterthanever
using this format would solve the issue

Code: Select all

StringToDate(SRC.DATE,'%m/%d/%yyyy')

Re: StingtoDate

Posted: Wed Mar 11, 2009 2:26 pm
by devanars
what is the format i can use if i need to keep the date like 19 sep 2008.

Posted: Wed Mar 11, 2009 3:15 pm
by chulett
:? What do you mean 'keep the date'? A date is a date and is stored in an internal representation, only external (string) formats have display options like that. So use whatever mask matches the incoming date format in the StringToDate function.