StringToDate() issue in transformer stage

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
HemaV
Participant
Posts: 63
Joined: Wed Jan 09, 2008 1:38 am
Location: Bangalore

StringToDate() issue in transformer stage

Post by HemaV »

Hi All,

I used StringtoDate function in transformer stage as below:

StringToDate(Convert('-','',CurrentDate()),"%yyyy%mm%dd")

But in the target date still comes with yyyy-mm-dd format. Unable to understand the issue.

Thanks in Advance,
vamsi.4a6
Participant
Posts: 334
Joined: Sun Jan 22, 2012 7:06 am
Contact:

Post by vamsi.4a6 »

1)I hope The default date format is yyyy-mm-dd in your project and If you need some other format use DatetoString function but the output will be of type string type.
Thanks and Regards
Vamsi krishna.v
http://datastage-vamsi.blogspot.in/
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

CurrentDate() is not a string, so Convert() will not work on it. Leave it out.

Code: Select all

DateToString(CurrentDate(),"%yyyy%mm%dd") 
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
HemaV
Participant
Posts: 63
Joined: Wed Jan 09, 2008 1:38 am
Location: Bangalore

Post by HemaV »

Thanks All....

DateToString() function works but how can i convert the datatype of string to date as my target column in db is having date datatype :(.

I need to check on project default date format once because StringToDate() function is now working for me...


Thanks,
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

HemaV wrote:I need to check on project default date format once because StringToDate() function is now working for me...
:?

"now" = "not"?

There's no need to check on anything as dates don't have a particular format - strings do but dates do not. If you know what format your string date is in, then use that in the StringToDate function and you'll be golden.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Data type Date is stored in a four-byte binary format.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply