Date datatype 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
srai
Participant
Posts: 101
Joined: Wed Feb 09, 2005 10:50 pm

Date datatype conversion

Post by srai »

Hi,

I reading from Oracle database and loading into sequecial file.

From Oracle source Date is coming as

21-03-11
15-04-00
16-11-81

and we need output as
21-03-2011
15-04-2000
16-11-1981

I am trying to function StringtoDate(Columnname,"%dd-%mm-%yyyy").
But its not getting converted in required format.
Please suggest if I am using wrong derivation.

Thanks.
sathishmca
Participant
Posts: 43
Joined: Mon Mar 03, 2008 10:58 pm
Location: Chennai

Re: Date datatype conversion

Post by sathishmca »

Hi,

StringtoDate(Columnname,"%dd-%mm-%yyyy").
Here ,"%dd-%mm-%yyyy" should match with your source data. Just try that.

Thanks
srai
Participant
Posts: 101
Joined: Wed Feb 09, 2005 10:50 pm

Re: Date datatype conversion

Post by srai »

Hi,

Thanks for reply.

This means if my source data is like 21-03-11 then it should be
StringtoDate(Columnname,"%dd-%mm-%yy") and output will be as
21-03-2011.

Thanks,
Santosh
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Hi,

Just try

Code: Select all

StringToDate(column,"%(d,s)-%(m,s)-%yy).
if the result is still not as exepected, then apply one more DateToString()
pandeeswaran
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Date datatype conversion

Post by chulett »

srai wrote:This means if my source data is like 21-03-11 then it should be StringtoDate(Columnname,"%dd-%mm-%yy") and output will be as 21-03-2011.
No, your output will be a date which has no external format. If you need another string then you'll need to enclose the result in a DateToString() function with the appropriate output mask.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply