Date Conversion

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Bilwakunj
Participant
Posts: 59
Joined: Fri Sep 10, 2004 7:00 am

Date Conversion

Post 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.
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Post 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
gh_amitava
Participant
Posts: 75
Joined: Tue May 13, 2003 4:14 am
Location: California
Contact:

Post 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
vbeeram
Participant
Posts: 63
Joined: Fri Apr 09, 2004 9:40 pm
Contact:

Date format

Post 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
Bilwakunj
Participant
Posts: 59
Joined: Fri Sep 10, 2004 7:00 am

Re: Date format

Post 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
Post Reply