Page 1 of 1

Date Conversion

Posted: Wed Apr 06, 2005 10:50 pm
by Bilwakunj
Hi ,
I have a col of char '8' and another of char '10'. Using stringToDate() function I'm trying to convert these columns to a date, with the default date format. But it's not working. The job is getting aborted.

Well I'm putting following in the derivation

StringToDate(inData.Date1) -- and trying to store it in the Date , data type column.The i/p data is in the YYYYMMDD format and I want the same in the o/p so I'm not giving any format string.

Can anybody plz tell me , what mistake I'm doing?

Thanks.

Posted: Thu Apr 07, 2005 2:19 am
by richdhan
Hi Bilwakunj,

Before we go ahead I need some info

1. What is the error message you are getting when the job got aborted?

2. How do you confirm that it is because of StringToDate function used in the Transformer?

We have used char(10) columns from input and have coverted them into Date using the StringToDate function and we did not face any problems.

My suggestion is that you take the input, do the transformation and load it into a dataset. Try to view the dataset. If you get ******* then it is definitely a problem with the incoming data or the formatting option you are using.

HTH
Rich

Posted: Thu Apr 07, 2005 2:38 pm
by gh_amitava
Hi,

The default date format in DataStage is yyyy-mm-dd.. But your input format is yyyymmdd. So you have to mention the input format as
"%yyyy%mm%dd" in the StringToDate function.

Regards
~Amitava

Date format

Posted: Sun Apr 10, 2005 7:22 pm
by vbeeram
Hi,

Yours source column must be String type i.e varchar
You also specify the I/P Source format.

Syntax: StringToDate(Column,"source column format ")

In your case
ex:StringToDate(DateLiknk.Date1,"%yyyy%mm%dd")

This will work.

Rgds
Thiru

Re: Date format

Posted: Tue Apr 12, 2005 8:30 pm
by Bilwakunj
Thanks...it worked

Bilwakunj

vbeeram wrote:Hi,

Yours source column must be String type i.e varchar
You also specify the I/P Source format.

Syntax: StringToDate(Column,"source column format ")

In your case
ex:StringToDate(DateLiknk.Date1,"%yyyy%mm%dd")

This will work.

Rgds
Thiru